Comments on: Prevent Redundant Approval Requests in ServiceNow https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 19:27:44 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9594 Tue, 29 Nov 2016 21:02:24 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9594 OOOOOOK. This does make sense now.
I think I was close to find that out myself as I was wondering about the logic of the condition. Now this is clear.
Thanks a lot!

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9593 Tue, 29 Nov 2016 20:26:56 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9593 In reply to Fred.

I think I see what’s going on now. All of your approvals are being included in the same approval activity. That’s not what this utility handles. This is for different approvals that are added later in an approval workflow. In your situation the workflow activity should handle this for you (or you need to code in logic in the workflow activity to make sure the same person isn’t added twice. I think the reason ServiceNow has left it this way is that you could argue (particularly for a group approval activity) that each user should need to approve on behalf of each group they are a member of.

]]>
By: Fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9592 Tue, 29 Nov 2016 19:47:09 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9592 Hi again,
still struggling.
I tried in the developer instance – using the OoB Change Request Workflow and added a 2nd group to the CAB approval approvers and put same person in both groups.

With or without the Business Rules … same is happening.
Approval mail generated twice. After approving one of the approval tasks .. the 2nd approval is still open to be approved (for the same user).

No idea what is going wrong … any idea on that?

]]>
By: fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9591 Tue, 29 Nov 2016 15:50:55 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9591 Thanks! That was the problem (never have seen that before … ). Saving possible.

Unfortunately it is not working anyhow. Need to further investigate. Have 2 approvals sent to to different groups … meaning double mails in case one person is in both groups.

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9590 Tue, 29 Nov 2016 15:41:56 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9590 In reply to Fred.

I’m not sure what else you can try then. I can enter that condition without issue into the standard ‘Condition’ field on the business rule in my Helsinki instance. You’re correct that the condition builder is removed, but the standard field should still work. You may try typing it in manually or testing with a completely different condition to see if anything works at all for you.

]]>
By: Fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9589 Tue, 29 Nov 2016 15:37:35 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9589 When u change the “when” to “asncy” the filter conditions disappear .. . Same on my developer instance … there might be a reason for that ?! I could not find any UI Action that is triggering that (on the sys_script table) …

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9588 Tue, 29 Nov 2016 15:26:35 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9588 In reply to Fred.

Might be a copy/paste issue. You might try typing it in directly and see if that helps. You could also use the condition builder widget on the business rule to provide the condition.

]]>
By: Fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9587 Tue, 29 Nov 2016 15:18:18 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9587 In reply to Mark Stanger.

Thanks Marks for the reply. Unfortunately conditions are somehow not possible to be used when set to async even there is a condition field on top of the script … but entering the condition – current.state == ‘not_required’ .. the error occurs: “JavaScript parse error at line (1) column (18) problem = illegal character (; line 1)” …
any idea?

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9586 Tue, 29 Nov 2016 14:50:38 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9586 In reply to fred.

I think you’re probably right about the ‘changesTo’ in the Async script above. You should be safe to change the condition to current.state == ‘not_required’ and it should work fine though. Normally I wouldn’t recommend running a business rule every time a state equals that value just because it’s going to be running way more than is necessary, but in this case an approval really wouldn’t be updated very often (if at all) once it reaches a ‘not required’ state. I’ve updated the article above reflecting this change.

]]>
By: fred https://servicenowguru.com/business-rules-scripting/prevent-redundant-approval-requests-servicenow/#comment-9585 Tue, 29 Nov 2016 13:51:36 +0000 https://servicenowguru.wpengine.com/?p=5084#comment-9585 I’m troubleshooting the same issue. We r on Helsinki already. So not sure if this is still working.
What I see is that the async business rule seems not to have a condition …
ServiceNow: “Note: Asynchronous business rules do not have access to the previous version of a record. Therefore, these GlideElement methods do not work with async rules: changes(), changesTo(), changesFrom().”

… so I’m wondering how the 2nd Business Rule mentioned above will be fired without the condition set. Sorry I’m not the scripting guy ;-)

]]>