I need to understand the condition in ui action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 10:08 AM - edited 02-09-2023 07:06 PM
Hi,
I need to understand how the condition in ui action and the if condition in the script will work. Can anyone help me to understand the how its work.
Condition: newGlideRecord("incident").canCreate() && ((current.isNewRecord() && current.canCreate()) || !current.isNewRecord())
Script:
var canCreateIncident = false;
if ((current.isNewRecord() && current.canCreate()) || (!current.isNewRecord() && current.canWrite()))
canCreateIncident = current.update();
else
canCreateIncident = true;
if (canCreateIncident) {
var inc = new GlideRecord("incident");
inc.short_description = current.short_description;
inc.description = current.u_description;
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 09:31 AM
The script in field Condition is executed when the form is built and it is decided whether to include the UI Action or not.
The script in field Script is executed right after the UI Action is pressed.