Abort action based on some value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 02:38 AM
I have a field name "counter", which count the number of times a task is reassigned to another person using "Assigned to" field.
Based upon counter value (say 3) i.e. if same task is reassigned more than 3 times to another person, it should not allow to change.
I got answer where in database it is not allowing to change (once I refresh the page) but in "Incident form " it is allowing i.e. it is reassigned to another person in "Assigned to" field.
I want to stop user from changing in "Assigned to" field also .
I am using Business rule and my code is :
(function executeRule(current, previous /*null when async*/) {
var counter;
if(current.assignment_group.changes())
{
counter=current.u_counter=0;
}
else if(current.assigned_to.nil())
{
current.u_counter=0;
}
else if(current.u_counter>3)
{
gs.addInfoMessage("You excede more than 3 time ! Now you cannot changed Assigned to field");
current.state=previous.state;
gs.setValue('assigned_to', current.state);
current.setAbortAction(true);
gs.setRedirect(current.state);
}
else
{
current.u_counter += 1;
}
})(current, previous);
Please help.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 04:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 03:34 AM
Code is working fine, but my requirement is to stop user from changing "assigned to " field in the form. It should not allow user to change the name of "assigned to" in the Incident form.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 03:41 AM
That's exactly what the above code does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 04:08 AM
But in Incident form user can assigned to another person using look up.In form it is taking , but
My task is to stop user from further selecting person from "Assignment to" field in the Incident management , i.e once the name is selected user cannot change futher( like make it read only field type) with last assigned user name written in it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2016 04:31 PM
Then use the first Business Rule with a UI Policy.
Condition: Counter 'greater than' 3
Action: Make Assignment group read-only.