current.setAbortAction(true) causes the error message 'Invalid update'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2013 08:26 AM
Guys,
I got stuck with current.setAbortAction(true) in a business rule... I have a simple business rule on an incident table:
When:
Before
Update:
yes
Condition:
current.category=='Software'&& !current.hasAttachments()
Script:
gs.addInfoMessage("No attached documents found! Operation cancelled.") current.setAbortAction(true);
But this rule causes and error message 'Invalid update' when I try to save an incident without attachments and with Category='Software'. My custom info message will be displayed as well, but why 'Invalid update' is there???
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2013 08:36 AM
That message is hardcoded when an action has been aborted by setAbortAction(). I'm unaware of a way to not have it show.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2013 08:49 AM
Are you sure about that? Because I have another business rule with setAbortAction(), it works fine and there is no 'Invalid update' message:
This rule intercepts removal of approval records
Table:
sysapproval_approver
When:
Before
Delete:
Yes
Condition:
current.wf_activity==''&&current.state!='requested'&&current.state!='approved'&&current.state!='rejected'
Script:
current.comments = 'Approval record has been permanently deleted/removed from the original ticket '+current.sysapproval.number+' by '+gs.getUser().getFullName();
if (current.state=='not requested') { current.state = 'not_required'};
current.sysapproval = '';
current.update();
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2013 08:58 AM
In your script example, the setAbortAction() is after the update(), so the update to the database has already happened. I don't think any message would be displayed in that case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2013 03:46 PM
May be you are missing the semicolon after the gs.addInfoMessage() method..