I want to write the BR to trigger the approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 12:02 AM
Hi,
I want to trigger the approval to "XY" group, if requested for ( all catalog item) manager is empty. Can anyone help here to write the business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 12:13 AM
You can consider to have a flow and set according trigger condition to start.
In the other hand, if you wanna start the flow within business rule by some specific reason that can't be handled by the trigger condition, you can use the FlowAPI.
startFlow(String name, Map inputs)
(function() {
var now_GR = new GlideRecord('incident');
now_GR.addQuery('number', 'INC0009009');
now_GR.query();
now_GR.next();
try {
var inputs = {};
inputs['current'] = now_GR; // GlideRecord of table: Incident
inputs['table_name'] = 'incident';
var contextId = sn_fd.FlowAPI.startFlow('global.test_flow', inputs);
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 12:14 AM
Why a business rule? Service Requests are handled through (work)flows (OOB) and all logic for approval is in preconfigured actions/activities. Just creating a BR to create an approval record, will also mean that all other logic needs to be created outside the (work)flow. Just get the requested for within the (work)flow, check on its manager and if none, create the approval for the group.
And what didn't work in the solution you accepted on this question: https://www.servicenow.com/community/developer-forum/need-to-create-a-subflow/td-p/3106811
It is exactly what you are asking for.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 12:20 AM
Hi @PRAGHATIESH S
Please create Business rule on table sc_req_item. and give condition for Business rule to trigger,
Script :