How to render a dialog box based on a condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 05:32 AM
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 ?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 06:19 AM
Hi Saranya,
Can you add this alert and check what it gives in first line of the function:
alert(g_form.getValue('u_fieldname'));
if it is not 1 then it should go inside else part. also what type of field that is. Is it integer or string field?
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 06:23 AM
Hi ankur,
Its a integer field, I just did what you said, it throws no alert,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 06:26 AM
Hi Saranya,
Is that field empty or there is some value present in the form for this field?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 06:31 AM
Hi Ankur,
Some value is present in this field, We have configured choice list for this field , condition is to check with one of the choices window should open for other choices alert should be thrown
Thanks
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 06:33 AM
Hi Saranya,
So since that field is empty it should go inside the else condition since it won't match with value as 1
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader