How to increase the length of condition in workflow

Priyanka145
Tera Contributor

Hi All,

 

I am having a workflow , using a branch activity.

Branch contains 4 conditions. I want the condition length of branch to be increased as I am having  multiple conditions to get it filled in

Please let me know how can I increase the length of branch condition.

 

Priyanka145_0-1712158194327.png

 

2 REPLIES 2

Community Alums
Not applicable

Hi @Priyanka145 ,

 

For easier maintainability, keep the condition as short as possible. If the computation is complex, it is difficult to read and understand. Rather than increasing the field length, consider putting your logic in a script include. For example, rather than something like this...



 

current.active && current.canRead() && (current.state == 4 || current.state == 5 || current.state == 7) && (current.u_requester.department.getDisplayValue == 'Marketing' || current.u_requester.getDisplayValue() == 'HR') || gs.hasRole('admin')

 

 

 

It could look something like this:



 

new myConditionCheck().ApprovalUIAction(current);

 

 

and your script include becomes a thing of beauty to maintain and extend.

 

This is the recommendation from @Chuck Tomasi  : https://www.servicenow.com/community/developer-forum/increase-the-max-length-hof-condition-in-ui-act...

 

Sagar Pagar
Tera Patron

Hi @Priyanka145.

 

As Sandeep mentioned, you need to write conditions in Script Include and you need to call it in condition field.

 

Thanks,
Sagar Pagar

The world works with ServiceNow