- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2023 07:56 AM
Story should not be move to complete state until the associated defect of that story is not closed. I want to perform abort action.
What is the ideal way to use Business rule or flow designer ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2023 11:05 PM - edited 09-30-2023 11:18 PM
Hi @Balakrishna_ABK,
According to ServiceNow best practices, it's advisable to use Flow Designer if you can achieve the same configuration with a business rule or Flow Designer. However, in your scenario, the `current.setAbortAction(true)` only works in a Before business rule. For your reference, I'm attaching a link to a community thread: [Community Thread Link](https://www.servicenow.com/community/developer-forum/how-to-setabortaction-in-a-custom-action-in-a-f...).
If you wish to achieve the same result with a business rule, follow these steps:
**Step 1:** Create a Before business rule on the Story Table with the following conditions:
- State Changes to Complete
- And Defect.State is not Closed Complete
**Step 2:** In the Action Tab, check Add Message and Abort Action Field.
Once you complete these steps, you will observe that stories are not getting updated if the related defect is not Closed Complete.
Please mark ✅ Correct if this resolves your issue, and also mark 👍 Helpful if you find my response valuable based on the impact.
Regards,
Astik Thombare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2023 11:05 PM - edited 09-30-2023 11:18 PM
Hi @Balakrishna_ABK,
According to ServiceNow best practices, it's advisable to use Flow Designer if you can achieve the same configuration with a business rule or Flow Designer. However, in your scenario, the `current.setAbortAction(true)` only works in a Before business rule. For your reference, I'm attaching a link to a community thread: [Community Thread Link](https://www.servicenow.com/community/developer-forum/how-to-setabortaction-in-a-custom-action-in-a-f...).
If you wish to achieve the same result with a business rule, follow these steps:
**Step 1:** Create a Before business rule on the Story Table with the following conditions:
- State Changes to Complete
- And Defect.State is not Closed Complete
**Step 2:** In the Action Tab, check Add Message and Abort Action Field.
Once you complete these steps, you will observe that stories are not getting updated if the related defect is not Closed Complete.
Please mark ✅ Correct if this resolves your issue, and also mark 👍 Helpful if you find my response valuable based on the impact.
Regards,
Astik Thombare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2023 11:23 PM
hi @swastikp3 , Thanks for your reply, I want to set state value to previous state in the same code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2023 01:06 AM
As per the screenshot, the State field is not set to complete. If you refresh the page, it will return to the same state because we are aborting the action using the "Abort Action" field.
When the page is not refreshed:
When the page is refreshed:
Please mark ✅ Correct if this resolves your issue. Also, mark 👍 Helpful if you find my response valuable based on the impact.
Regards,
Astik Thombare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2023 09:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2023 09:25 PM
Hi @astik, I want to set value before refreshing the page.