I need to understand the condition in ui action?

Community Alums
Not applicable

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 

 

 

10 REPLIES 10

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.