Calling a Script Include in a Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2022 06:14 AM
Hey Everyone,
I am trying to call a script include in the flow designer and the logic implemented here is based on the country selected
,the assignment group will be set for the catalog task accordingly.
Script Include:
------------------
Name-EXPClientOnboardUtils
Scope- Global
Script:
--------
var EXPClientOnboardUtils = Class.create();
EXPClientOnboardUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
CSMAssignmentGroupMappings: [
{country: 'Australia', assignment_group: 'd59f25ecdb48fb88bdb1317ffe9619ed'},
{country: 'New Zealand', assignment_group: 'd59f25ecdb48fb88bdb1317ffe9619ed'},
{country: 'Brazil', assignment_group: 'c0e07354dba5485824b89e57f4961962'},
{country: 'Colombia', assignment_group: 'a239e22edb75d01878ce794039961903'},
{country: 'India', assignment_group: 'd59f25ecdb48fb88bdb1317ffe9619ed'},
{country: 'Singapore', assignment_group: 'd59f25ecdb48fb88bdb1317ffe9619ed'},
{country: 'Netherlands', assignment_group: '9f99af38db74d8d8ad91fbf9f4961925'},
{country: 'Spain', assignment_group: '0da7e7e0dbb2c09cad91fbf9f49619d4'},
{country: 'United Kingdom', assignment_group: 'f80ea82edb1ee380ac273f3ffe9619d2'},
{country: 'Ireland', assignment_group: 'f80ea82edb1ee380ac273f3ffe9619d2'}
],
CSSAssignmentGroupMappings: [
{country: 'Australia', assignment_group: '6b47d6f9db069fc4216b3f3ffe961951'},
{country: 'New Zealand', assignment_group: '6b47d6f9db069fc4216b3f3ffe961951'},
{country: 'Brazil', assignment_group: 'a84bfa83db190414aebd0578f49619bc'},
{country: 'Colombia', assignment_group: 'a239e22edb75d01878ce794039961903'},
{country: 'India', assignment_group: '6b47d6f9db069fc4216b3f3ffe961951'},
{country: 'Netherlands', assignment_group: 'dce3b701db78d49c7d5992c9f49619b6'},
{country: 'Singapore', assignment_group: '6b47d6f9db069fc4216b3f3ffe961951'},
{country: 'Spain', assignment_group: 'ea01c941db3ec05c7d5992c9f4961908'},
{country: 'United Kingdom', assignment_group: '3940f263db0e6b08615e317ffe9619d1'},
{country: 'Ireland', assignment_group: '3940f263db0e6b08615e317ffe9619d1'}
],
ApproverAssignmentGroupMappings: [
{country: 'Australia', assignment_group: 'bf8e8f191b63c590ac35b8c2cd4bcb39'},
{country: 'New Zealand', assignment_group: 'bf8e8f191b63c590ac35b8c2cd4bcb39'},
{country: 'Brazil', assignment_group: '8ac60ea31b260d10323939f4464bcb6c'},
{country: 'Netherlands' , assignment_group: 'b5b8527b1b93411409a339f4464bcbb6'},
{country: 'Singapore', assignment_group: 'bf8e8f191b63c590ac35b8c2cd4bcb39'},
{country: 'Spain', assignment_group: '40b8da7f1b5b0114920639f4464bcb43'}
],
getAssignmentGroup: function(country,type){
var assignmentGroup = '';
var assignmentGroupMappings = '';
switch(type){
case 'CSM':
assignmentGroupMappings = this.CSMAssignmentGroupMappings;
break;
case 'CSS':
assignmentGroupMappings = this.CSSAssignmentGroupMappings;
break;
case 'Approval':
assignmentGroupMappings = this.ApproverAssignmentGroupMappings;
break;
}
assignmentGroupMappings.forEach(function(obj){
if(country == obj.country)
assignmentGroup = obj.assignment_group;
});
return assignmentGroup;
},
type: 'EXPClientOnboardUtils'
});
Based on the country type (CSM/CSS/Assignmnet group) the catalog tasks will be assigned to the appropriate
assignment group.
Flow Designer:
Please do let me know how we can call and assign to different assignment groups through the flow designer.
Thanks in Advance,
Sambit
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 11:59 AM
Hi, @Hitoshi Ozawa! How do you reference multiple return values?
In your example, you have:
var assignmentGroup = assignmentGroupMappings[type][country];
return assignmentGroup;
What if you want to have:
return thisValue1;
return thisValue2;
How do you reference that in Flow Designer? Do you reference it like this:
outputs.value1 = util.thisValue1;
outputs.value2 = util.thisValue2;
Please advise.
Thanks,
Harriet

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2022 05:51 PM
Hi again,
>Based on the country type (CSM/CSS/Assignmnet group) the catalog tasks will be assigned to the appropriate assignment group.
If this means setting a variable "assignment group" on Service Catalog item, this will be completely different question.
It would be easier to create an onChange() client script to call and fill "Assignment Group" field when filling out a form instead of using Flow Designer.
If the Assignment Group is to be filled when the form is submitted, it would be better to create a Business Rule rather than using Flow Designer.
If it is absolutely necessary to use Flow Designer, another Action need to be created. Follow the steps in the following article.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 08:29 AM
Hey Hitoshi,
Many thanks for the detailed stepwise explanation and here I am trying to assign the catalog task based on the country field(string type) value selected in the catalog form.
Again much appreciated assistance .I will try to implement this from my end and get back to you in case of nay concern.
Thanks,
Sambit