- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 10:32 PM
Hi ,
Just wondering if its ok to increase the Max Length of Condition field in the UI Action?
Regards
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 06:05 AM
Hi John,
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.
var myConditionCheck = Class.create();
myConditionCheck.prototype = {
initialize: function() {
},
ApprovalUIAction : function(gr) {
var isAdmin = gs.hasRole('admin');
var canRad = gr.canRead();
var isActive = gr.active;
var isGoodState = (gr.state == 4 || gr.state == 5 || gr.state == 7);
var dept = gr.u_requester.department.getDisplayValue();
var isGoodDept = (dept == 'Marketing' || dept == 'HR');
if (isActive && canRead && isGoodState && isGoodDept || isAdmin)
return true;
return false;
},
type: 'myConditionCheck'
};
Andrew and I covered this in our video a while back:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 10:38 PM
used advanced script instead

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 10:38 PM
As far as I know, there should not be any issues

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 10:41 PM
But I usually prefer to use script include in the condition field and do all the dirty work in the script include and return true or false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 02:52 AM
can you pl give me an example