send approvals based on country selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:06 AM
Hello,
we have a MRVS, wehre we have a list collector variable called"country", which is pulling data from "core_country" table.
now, when a user selects "china" and "indonesia" respectively the approvals should go to china approval group and also to indonesia approvals group.
like this we have multiple country, so based on country variable we want to trigger approvals.
Note: the variable country is inside the MRVS, Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:23 AM
Are you also copying that variable into a field on your form, or is it really just a variable?
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
03-29-2024 02:37 AM
I think you can use a combination of Business Rules and Workflow to dynamically assign approval groups based on the selected countries in the Multi-Row Variable Set.
First, ensure you have approval groups set up for each country. For example, you should have a "China Approval Group" and an "Indonesia Approval Group".
> Business rule to trigger when the MRVS field "country" changes(Sample code below)
(function executeRule(current, previous /*null when async*/) {
var countryList = current.country.toString().split(','); // Get selected countries as an array
var approvalGroups = [];
// Map selected countries to approval groups
for (var i = 0; i < countryList.length; i++) {
var country = countryList[i].trim(); // Trim to remove any whitespace
switch (country) {
case 'China':
approvalGroups.push('China Approval Group');
break;
case 'Indonesia':
approvalGroups.push('Indonesia Approval Group');
break;
// Add cases for other countries as needed
}
}
// Set approval groups for the record
current.approval_groups = approvalGroups.join(','); // Join approval groups into a comma-separated string
})(current, previous);
- Next, create a workflow that triggers when records are inserted or updated and the "approval_groups" field changes.
- In the workflow, add approval activities configured to use the approval groups specified in the "approval_groups" field.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 02:44 AM
Hi @Anubhav Srivas1 ,
If there are countable countries then you can use script to decide the approvals.
If there are many then did you try to make use of decision building feature in servicenow ?
Let me know how do you want to go ?
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....