Call script include in UI action for specific field users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 03:41 AM
Hi Team,
I want to create Script include for below condition to call in UI action, in UI action I can't mention it has reached maximum character
current.requested_by == gs.getUserID() || current.requested_by.manager== gs.getUserID()
Please suggest, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 04:22 AM
You can replace the above with only your SI call, passing in current.requested_by as an argument. In the SI, do whatever you were going to do, then also check if the current user is the requested_by or their manager and return the appropriate true or false for all of those conditions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 08:58 AM
@Ash41 Here is how you can create a script include to capture this condition.
var CheckConditionSI = Class.create();
CheckConditionSI.prototype = {
initialize: function() {
},
checkCondition: function(current) {
// Get the requested_by and their manager from the current object
var requestedBy = current.requested_by;
var userID = gs.getUserID();
// Check if the current user is the requested_by or their manager
return requestedBy == userID || requestedBy.manager == userID;
},
type: 'CheckConditionSI'
};
Here is how you should call this script include from the condition field of your UI Action.
new CheckConditionSI().checkCondition(current);
Hope this helps.