How to render a dialog box based on a condition

saranyadevic
Kilo Contributor

Hi all,

I have created a glide dialog window which will get input and update the record,

Now i need to show the input field when another field of a table is holding a particular value else it should throw error,

client checked

UI action   :

function updateIncidentDetails() {

var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;

//Initialize and open the dialog

var gDialog = new GlideDialogWindow("alert_incident_window");//Instantiate the dialog containing the UI Page 'alert_incident_window'

gDialog.setTitle("Enter incident details");

gDialog.setPreference('sysparm_sysID', sysId);

gDialog.setPreference('sysparm_table', "em_alert");

gDialog.render();//Open the dialog

}

The above Ui action will get the incident id value in a text box and update it in the remote task id,     along with the UI page

I need to display the dialogue box only if the   another field has desired value

consider u_fieldname == 1

if i add in the condition of UI action   alert is shown   as 'Security does not allow the execution of that action against the specified record'

Instead i need a custom alert message to be populated

Can this be achieved ?

26 REPLIES 26

Hi Ankur



The field is already present in the form layout



Thanks


is there any other thing you could think of


Hi Saranya,



The value is not fetched that is the main concern. If the field is present on form layout and has value then it should give the alert with that value.



One last try would be check the column name once again.



Regards


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yea column name is correct ,   still its not working



may be i should check everything again



Thanks Ankur


Hi Saranya,



Any update on this?


Can you mark answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader