Chavan AP
Kilo Sage

Hi All, 

 

I had a requirement to get SDM (Service Delivery Managers )  as an approver in Servicenow Change workflow. So this SDMs should be added in a company record as shown below:

 

So I have created a SDM field on Company record ( u_sdm )

find_real_file.png

 

Now  open the change workflow and add Approver User activity as need and write below code . This will give all the SDM users in approver.

 

// Set the variable 'answer' to a comma-separated list of user ids and/or group ids or an array of user/group ids to add as approvers.


if (!current.company.u_sdm_chg_approver){ //if company not flagged for SDMs to approve Changes
  answer = [];//empty array
}
else{  
  answer = new Array();
  var strClientSDMList = current.company.u_sdm.toString();
  answer = strClientSDMList.split(','); //grab ALL SDMs listed on the company record.
} 

 

Please give me advice incase anyone has an better way to achieve this.

Thank You,

AJay

Version history
Last update:
‎09-13-2019 08:22 AM
Updated by: