Can anyone let me know the Use Case of SYNC Business Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2018 10:31 PM
(Hi Developers,)
I know the reasons of why we should use the async over sync Business Rule.
My doubt is then whats the use case of sync Business Rule?
It would be good if you let me know use cases of both -async ,sync as it would help me to decide which one to use as per its scenarios/requirements.
Thanks in advance!!
Regards,
Snehal Madakatti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2018 10:46 PM
Hi Snehal,
After --Use to update information on related objects that need to be displayed immediately, such as GlideRecord queries.
You can use an async business rule in place of an after business rule. Async business rules are similar to after rules in that they run after the database commits a change. Unlike after rules, async rules run in the background simultaneously with other processes. Async business rules allow the system to return control to the user sooner but may take longer to update related objects.
Let's say you are posting a question on community and community is your service now instance
First, I need to check that you not posting any offensive materials. I can have a before rule to check that. According to the rules setup by me, either allow or disallow the posting of the question (Transaction).
Second, after you have passed the rules of posting and posted the question successfully. Someone opens up your question and likes your question. I need to award you points once the like is successful. I can have a after business rule to set this up.
Third, you will need to get email trigger when someone comments on your question. It does not need to be immediate. I can have a async rule to trigger the email.
Finally, I need to update the number of views of your question. I can have a display business rule to update the counter related to your question ..
I believe it clears to you. Please mark answer correct and helpful if served your purpose.
Regards,
Nikhil Dixit