- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 02:08 AM
Hello, got i problem with async rules.
Made a service,
created an app from this service
made a small business rule with "after" trigerring to test some things, had all the success i wanted.
But now i'd like this BR to call a webservice
It tells me i can't have the BR to "after" if i call a webservice (although it worked the first time but well ... )
So i switch to "async" and my Business rule doesnt seem to be called anymore. The conditions are on "current.approval", or even with no condition at all, or true
my condition is : current.approval=="approved"
here is the only mention of my business rule (manageNewUser) in the logs :
02:04:38.631: Execute before insert business rules on sys_trigger:ASYNC: manageNewUser before engines (order <1000)
02:04:38.631: Global ==> 'Ensure Valid Schedule' on sys_trigger:ASYNC: manageNewUser
02:04:38.631: Global <== 'Ensure Valid Schedule' on sys_trigger:ASYNC: manageNewUser
02:04:38.631: Finished executing before insert business rules on sys_trigger:ASYNC: manageNewUser before engines (order <1000)
02:04:38.632: Execute after insert business rules on sys_trigger:ASYNC: manageNewUser before engines (order <1000)
02:04:38.632: Global === Skipping 'Propagate run all nodes changes' on sys_trigger:ASYNC: manageNewUser; condition not satisfied: Condition: current.system_id == "ACTIVE NODES" || current.system_id == "ALL NODES" || (previous != null && (previous.system_id == "ALL NODES" || previous.system_id == "ACTIVE NODES"))
02:04:38.632: Global ==> 'Randomize minute for UA jobs' on sys_trigger:ASYNC: manageNewUser
02:04:38.632: Global <== 'Randomize minute for UA jobs' on sys_trigger:ASYNC: manageNewUser
02:04:38.632: Finished executing after insert business rules on sys_trigger:ASYNC: manageNewUser before engines (order <1000)
what can i do to make this rule execute ?
bonus question, how can i log a message in the script so that it appears in the log. I tried gs.log but it yells at me. gs.debug seems to not be working, even when i activated business rule log...
thank you
Christophe
Edit : I should add that this previous log is when the condition is OK
When the condition is NOT OK i have this log (that i prefer personnaly, but still ...)
02:16:36.246: App:Newcomer setup App
=== Skipping 'manageNewUser' on x_133971_newcomer_setup_task:NEW0001010; condition not satisfied: Condition: current.approval=="approved"Role Conditions: activity_admin,activity_creator,admin,agent_admin,api_analytics_read,approval_admin,approver_user,assessment_admin,asset,assignment_rule_admin,atf_test_admin,atf_test_designer,bsm_legacy,bsm_legacy_admin,business_rule_admin,catalog,catalog_admin,catalog_e
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 12:21 AM
Ok so turns out i'm too new to this
Async means async so in logs, you probably won't see anything.
Though, when i watch the outgoing http logs, there is was my async request, so i guess it's working as it should !
sorry for disturbance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 02:16 AM
Hi Christophe,
Async Br doesn't have 'previous' object on it, so if you code/condition uses previous ior 'changesFrom' or 'changesTo' then it wont work, can you check if any of these are present in the BR??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 02:18 AM
yup i understood this subtility, as you can see in my "edit" the condition is : current.approval=="approved"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 02:17 AM
Hi Christophe,
The debug business rules will help you to check whether the business rule itself is triggered or not. As said in screenshot it says condition not satisfied for async business rule "manageNewUser".
I think previous object doesn't work in async so it must not be triggering. Remove the condition from business rule and print these statements in log. That will confirm whether previous system_id could be printed or not.
gs.info("Previous value is:"+previous.system_id);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 02:22 AM
see in my "edit" the condition seems to work.
The logs are different when it is OK and NOT OK.
i'm not using previous, only current as it perfectly stated in the executeRule template that the previous is null if async rule.