short description for each approval in workflow

Gemma4
Mega Sage

Hi Everyone,

I have a new hire workflow that I’m having trouble understanding how to configure the approval task short descriptions to display a unique short description. I’m not the best with scripts and workflows and would appreciate any insight you all have. Below is a copy of the workflow we are using and the approvers that are currently getting generated. As you can see, all the approver short descriptions look the same. Instead, it would be great if the short description pulled the information from the SD for 0365 run script and SD for laptop approval run script. So, for example, the short description should read New Hire Checklist Request first name last name and task details. I’ve tried so many variations in the run script and adding a new set values without any luck. This would allow the approver to understand if they approving a O365 of Laptop request. 

Thanks in advance for any feedback you have! 

Gemma

workflowExample.pngapproversExample.png

9 REPLIES 9

Kristen Ankeny
Kilo Sage

Can you share the script in one of the run scripts and the configuration of the corresponding approval?

sure , thanks so much. 

this is the first run script and below the o365

//var ref = current.variables.reference_id.toString();

//current.short_description =
//"New Hire Checklist Request for " +
//current.variables.preferred_first_name + " " +
//current.variables.last_name;

//current.description =
// "New Hire Checklist Request - Requested For : " +
// current.variables.preferred_first_name + " " +
// current.variables.last_name;

//Populate the New Hire Details table with all the various variable values selected by the user.
var gr = new GlideRecord('u_new_hire_details');
gr.addQuery('sys_id', ref);
gr.query();
while(gr.next())
{
//IT Details.
gr.u_office_distro = current.variables.office_distro;
gr.u_laptop_type = current.variables.laptop_type;
gr.u_additional_software = current.variables.additional_software;
gr.u_distribution_lists = current.variables.distribution_lists;
gr.u_shared_mailboxes = current.variables.shared_mailboxes;
gr.u_it_home_office_equipment_delivery_date = current.variables.equipment_delivery_date;
gr.u_purecloud = current.variables.purecloud;
gr.u_requested_item = current.sys_id;

gr.u_it_early_laptop_delivery_date = current.variables.laptop_delivery_date;
gr.u_it_address_verified = current.variables.it_address_verified;
gr.u_home_office_printer_required = current.variables.printer_required;
gr.u_it_home_office_equipment = current.variables.home_office_equipment;
gr.u_it_bitbucket = current.variables.bitbucket;
gr.u_it_confluence = current.variables.confluence;
gr.u_it_devone_login = current.variables.dev_one_login;
gr.u_it_jira = current.variables.jira;
gr.u_it_lucidchart = current.variables.lucidchart;
gr.u_it_replicon = current.variables.replicon;
gr.u_it_iphone = current.variables.it_iphone;
gr.u_it_iphone_apps = current.variables.it_iphone_apps;
gr.u_purecloud = current.variables.purecloud;

//Clinical Details
gr.u_clinical_role = current.variables.clinical_role;
gr.u_clinical_iq = current.variables.utilize_iq;
gr.u_clinical_mcg = current.variables.utilize_mcg;
gr.u_clincical_dual_market_contracts = current.variables.clincical_dual_market_contracts;
gr.u_clinical_case_types = current.variables.interqual_settings;
gr.u_clinical_nhcoordinateuserrole = current.variables.nhcoordinate_user_role;
gr.u_clinical_nhcoordinatecareteamrole = current.variables.nh_coordinate_care_team_role ;
gr.u_clinical_licensure = current.variables.clinical_licensure;
gr.u_afac_needed = current.variables.afac;
gr.u_afac = current.variables.enter_facilities;

//General feilds
gr.u_requisition_number = current.variables.requisition_number;
gr.u_preferred_first_name = current.variables.preferred_first_name;
gr.u_last_name = current.variables.last_name;
gr.u_first_name = current.variables.first_name;
gr.u_job_title = current.variables.job_title;
gr.u_direct_supervisor = current.variables.direct_supervisor;
gr.u_1_supervisor = current.variables.supervisor_level2;
gr.u_home_department = current.variables.home_department;
gr.u_region = current.variables.region;
gr.u_office = current.variables.office;
gr.u_office = current.variables.office;
gr.u_day_1_location = current.variables.day_1_location;
gr.u_employement_type = current.variables.employement_type;
gr.u_training_location = current.variables.training_location;
gr.u_shipping_address = current.variables.shipping_address;
gr.u_personal_phone_number = current.variables.personal_phone_number;
gr.u_personal_email = current.variables.personal_email;

//TimeStamp
gr.u_date_checklist_submitted_by_manager = new GlideDateTime();
gr.u_start_date = current.variables.start_date;
gr.u_orientation_date = current.variables.orientation_date;
gr.u_training_date = current.variables.training_date;

//Allocations fields -LOB
gr.u_deptcontractallocation1lob = current.variables.lob_1;
gr.u_deptcontractallocation2lob = current.variables.lob_2;
gr.u_deptcontractallocation3lob = current.variables.lob_3;
gr.u_deptcontractallocation4lob = current.variables.lob_4;
gr.u_deptcontractallocation5lob = current.variables.lob_5;
gr.u_deptcontractallocation6lob = current.variables.lob_6;
gr.u_deptcontractallocation7lob = current.variables.lob_7;
gr.u_deptcontractallocation8lob = current.variables.lob_8;
gr.u_deptcontractallocation9lob = current.variables.lob_9;
gr.u_deptcontractallocation10lob = current.variables.lob_10;
gr.u_deptcontractallocation11lob = current.variables.lob_11;
gr.u_deptcontractallocation12lob = current.variables.lob_12;

//Department
gr.u_deptcontractallocation1 = current.variables.dept1;
gr.u_deptcontractallocation2 = current.variables.dept_2;
gr.u_deptcontractallocation3 = current.variables.dept_3;
gr.u_deptcontractallocation4 = current.variables.dept_4;
gr.u_deptcontractallocation5 = current.variables.dept_5;
gr.u_deptcontractallocation6 = current.variables.dept_6;
gr.u_deptcontractallocation7 = current.variables.dept_7;
gr.u_deptcontractallocation8 = current.variables.dept_8;
gr.u_deptcontractallocation9 = current.variables.dept_9;
gr.u_deptcontractallocation10 = current.variables.dept_10;
gr.u_deptcontractallocation11 = current.variables.dept_11;
gr.u_deptcontractallocation12 = current.variables.dept_12;

//Percentage
gr.u_deptcontractallocation1pct = current.variables.pct1;
gr.u_deptcontractallocation2pct = current.variables.pct_2;
gr.u_deptcontractallocation3pct = current.variables.pct_3;
gr.u_deptcontractallocation4pct = current.variables.pct_4;
gr.u_deptcontractallocation5pct = current.variables.pct_5;
gr.u_deptcontractallocation6pct = current.variables.pct_6;
gr.u_deptcontractallocation7pct = current.variables.pct_7;
gr.u_deptcontractallocation8pct = current.variables.pct_8;
gr.u_deptcontractallocation9pct = current.variables.pct_9;
gr.u_deptcontractallocation10pct = current.variables.pct_10;
gr.u_deptcontractallocation11pct = current.variables.pct_11;
gr.u_deptcontractallocation12pct = current.variables.pct_12;
gr.u_contractallocation = current.variables.allocation_total;
gr.u_background_status = 'In Progress';
gr.u_manager_additional_comments = current.variables.manager_additional_comments;

gr.update();

//Generate various events...

//notify job title - contract-cosc
if( current.variables.job_title == 'a73b4df61be7f410ecf1639b234bcb3f')
gs.eventQueue('notify.contractor.csoc', current);
//when location is Newton
if(current.variables.day_1_location == 'Newton')
gs.eventQueue('notify.location.newton', current);
//when clinical and afac
if(current.variables.clinical_role == 'Yes' && current.variables.afac == 'Yes')
gs.eventQueue('notify.clinical.afac', current);
//when clicnical role
if(current.variables.clinical_role == 'Yes')
gs.eventQueue('notify.clinical_role', current);
//when non clinical role
if(current.variables.clinical_role == 'No')
gs.eventQueue('notify.non_clinical_role', current);
//when home department is Talent and culture
if(current.variables.home_department == 'Talent & Culture [TC0000]')
gs.eventQueue('notify.home.dpt', current);
//IT early shipment date
if(current.variables.laptop_delivery_date != '' )
gs.eventQueue('notify.early.laptop', current);
}

 

Office 365 run script below

 

//current.short_description = current.wf_activity.name;
//current.short_description =
//current.wf_activity.name + " " +
//current.variables.preferred_first_name + " " +
//current.variables.last_name;
//current.update();


//current.short_description =
// 'New Hire O365 Distribution Lists Approval for ' +
// current.variables.preferred_first_name + " " +
// current.variables.last_name;
//current.update(); do not add

 

 

Are the // in your code? If so, those lines are commented out and not running.

correct I commented them out because they were not working correctly. In the O365, it was causing all the approval  tasks to have "O365 Distribution Lists Approval for" and the short description of the ritm