Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to increase the length of UI Action condition

Priyanka145
Tera Contributor

Hi All,

 

Over the UI Action, I m not able to fully put my condition in the condition field .

 

(current.state < 3 && current.approval != 'requested' && !current.change_request.on_hold && current.u_external_ticket_number=='' && current.u_external_ticket_system_id=='') ||(current.u_external_ticket_number!='' && current.u_external_ticket_system_id!='' &&gs.getUserhasRole('admin'))||

(current.u_external_ticket_number!='' && current.u_external_ticket_system_id!='' &&gs.getUserhasRole('change_manager'))

 

Please someone help me letting know how can this be placed.

Priyanka145_0-1677257829080.png

 

 

 

1 ACCEPTED SOLUTION

@Priyanka145 ,

 

In the filter Navigator -> script Include -> Under Definition(script include).

 

PRINCE_ARORA_0-1677347427773.png

 

As mentioned in above screenshot, Please write your function in script include as mentioned:

HideUIAction:function(ref){
if((ref.state < 3 && ref.approval != 'requested' && !ref.change_request.on_hold && ref.u_external_ticket_number=='' && ref.u_external_ticket_system_id=='') ||(ref.u_external_ticket_number!='' && ref.u_external_ticket_system_id!='' &&gs.getUserhasRole('admin'))||
(ref.u_external_ticket_number!='' && ref.u_external_ticket_system_id!='' &&gs.getUserhasRole('change_manager'))){
return true
}else
return false;
},
In the UI action please call this script include using 
new scriptIncludeName.functionName() == "true";

 

 

 If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

View solution in original post

3 REPLIES 3

Prince Arora
Tera Sage

@Priyanka145 ,

 

I believe "condition" is the field of OOB table and its not the best practice to update the size, you can try with this method:

Calling the script include - new scriptInclude().functionName(current)  == true;

PRINCE_ARORA_0-1677258104939.png

 

In the script include you can mention your conditions and return true or false accordingly!

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

 

Hi @Prince Arora 

I am new to script include. Could you please help me how to put those conditions in script include and call it.

@Priyanka145 ,

 

In the filter Navigator -> script Include -> Under Definition(script include).

 

PRINCE_ARORA_0-1677347427773.png

 

As mentioned in above screenshot, Please write your function in script include as mentioned:

HideUIAction:function(ref){
if((ref.state < 3 && ref.approval != 'requested' && !ref.change_request.on_hold && ref.u_external_ticket_number=='' && ref.u_external_ticket_system_id=='') ||(ref.u_external_ticket_number!='' && ref.u_external_ticket_system_id!='' &&gs.getUserhasRole('admin'))||
(ref.u_external_ticket_number!='' && ref.u_external_ticket_system_id!='' &&gs.getUserhasRole('change_manager'))){
return true
}else
return false;
},
In the UI action please call this script include using 
new scriptIncludeName.functionName() == "true";

 

 

 If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.