Problem with setAbortAction(true)

Ana Beatriz1
Giga Expert

 

Is there a way to abort an action on field level and not for the whole record?

For example, we have a Business rules that abort changes on group if the assigned to is not pat of the group.

But if the user changes another field with a valid value, the whole record will not be updated because of the business rule that has way to abort an action just to one field.

I would like to abort the change only for the group, and allow the other fields to be updated without having to save they separately.

Thank you in advance. 

 

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

Hi Ana,

I think you are trying to find solution in wrong direction, why don't you just show only those users in assigned to field which are part of current assignment group (which is currently in place for most OOTB modules)? if someone changes assignment group after updating assigned to then clear out assigned to field.

With above implementation you don't need to maintain any script to validate assigned to.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

9 REPLIES 9

Pedro Grilo1
Mega Sage

Hi,

 

I believe the abort action will always abort all.

One option is to set the current value to the previous one and undo the changes before updating. Something like:

current.assignment_group = previous.assignment_group;

Not sure this matches your needs but may be an option.

 

Best regards,

Pedro

Thank you, Pedro for your response.


I see what you saying, but my problem is the following:

I have a Business Rule on incident_task that aborts the action if the user changes the assigmnet group to a group that the current assigned user is not member of.


And I also have a UI Action on incident_task that updates its Parent Incident.

The problem is that if I change a field with a valid value and change the assigmnet group to an invalid group and then click on the UI Action

the action is being done (the Parent Incident is being updated) without saving the valid field on incident_task, which is in incorrect. 

I would like to save the field with the correct value and abort only the the update of the assigment group field.

Hi Ana,

 

Probably you can check the reference qualifier for the assignment group and filter at the selection level rather than when using the UI Action.

Nevertheless, if you feel the ref qualifier does not suit your needs, feel free to share the UI action code so we can check.

 

Best regards,

Pedro

Hi Pedro, thank you very much for your response! Just proposed using a ref qualifier for that!