Set values of a record producer (via switch case scripting)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 11:55 AM
Hello everyone! I am working on a script to pass information from a record producer into an incident form as work notes. I am using a switch to produce the results and have successfully employed it for a specific case (New Hire/Rehire) but the other cases are not producing work notes. Any assistance is appreciated!
switch (producer.subcategory + "") {
case 'hr_action_notice':
case 'hr_action_notice_not':
switch (producer.ticket_subject + ""){
case 'New Hire/Rehire':
current.short_description = 'New Hire/Rehire';
current.work_notes = 'Hire Associate Reason: ' +producer.hire_associate_reason+ "\n"+
'Job Requisition to be Hired: ' +producer.job_requisition_to_be_hired+ "\n"+
'Candidate Name: ' +producer.candidate_name+ "\n"+
'Hire Date: ' +producer.hire_date+ "\n"+
'Job Status: ' +producer.job_status "\n"+
'Job Title: ' +producer.job_change_title2+ "\n"+
'Compensation: ' +producer.compensation+ "\n"+
'Additional Info: ' +producer.additional_info_comment_section;
break;
case 'Job Change':
current.short_description = 'Job Change';
current.work_notes = 'Associate Name: ' +producer.associate_name+ "\n"+
'Workday ID: ' +producer.workday_id+ "\n"+
'Effective Date: ' +producer.effective_date+ "\n"+
'Job Change - Reason: ' +producer.job_change_reason+ "\n"+
'Job Status: ' +producer.job_status+ "\n"+
'Job Title: ' +producer.job_change_title2+ "\n"+
'Additional Info: ' +producer.additional_info_comment_section;
break;
case 'Termination':
current.short_description = 'Termination:';
'Termination Reason: ' +producer.termination_reason+ "\n"+
'Associate Name: ' +producer.associate_name+ "\n"+
'Workday ID: ' +producer.workday_id+ "\n"+
'Last Day Worked: ' +producer.last_day_worked+ "\n"+
'Additional Info: ' +producer.additional_info_comment_section;
break;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 09:58 PM - edited ‎10-31-2023 09:59 PM
Let's try the below adjustment.
var short_description = '';
var work_notes = '';
switch (producer.subcategory + "") {
case 'hr_action_notice':
case 'hr_action_notice_not':
switch (producer.ticket_subject + "") {
case 'New Hire/Rehire':
short_description = 'New Hire/Rehire';
work_notes = 'Hire Associate Reason: ' + producer.hire_associate_reason + "\n" +
'Job Requisition to be Hired: ' + producer.job_requisition_to_be_hired + "\n" +
'Candidate Name: ' + producer.candidate_name + "\n" +
'Hire Date: ' + producer.hire_date + "\n" +
'Job Status: ' + producer.job_status + "\n" +
'Job Title: ' + producer.job_change_title2 + "\n" +
'Compensation: ' + producer.compensation + "\n" +
'Additional Info: ' + producer.additional_info_comment_section;
break;
case 'Job Change':
short_description = 'Job Change';
work_notes = 'Associate Name: ' + producer.associate_name + "\n" +
'Workday ID: ' + producer.workday_id + "\n" +
'Effective Date: ' + producer.effective_date + "\n" +
'Job Change - Reason: ' + producer.job_change_reason + "\n" +
'Job Status: ' + producer.job_status + "\n" +
'Job Title: ' + producer.job_change_title2 + "\n" +
'Additional Info: ' + producer.additional_info_comment_section;
break;
case 'Termination':
short_description = 'Termination:';
work_notes = 'Termination Reason: ' + producer.termination_reason + "\n" +
'Associate Name: ' + producer.associate_name + "\n" +
'Workday ID: ' + producer.workday_id + "\n" +
'Last Day Worked: ' + producer.last_day_worked + "\n" +
'Additional Info: ' + producer.additional_info_comment_section;
break;
}
current.short_description = short_description;
current.work_notes = work_notes;
break;
}
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2023 04:20 AM
Hey Tai,
That did not change the output for Job Change or Termination.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2023 05:15 AM
Hey Tai, this broke integration and nothing is coming over from opening incidents from the record producer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2023 08:42 PM
It works quite well per my check.
Let's double-check the Case Condition's Value and the actual value from your input in the variables Subcategory and Ticket Subject.
Cheers,
Tai Vu