The CreatorCon Call for Content is officially open! Get started here.

Map all catalog item variables to Description field on Incident

booher04
Tera Guru

Is there an easy way to map ALL of the variables from a catalog item to the description field of an Incident?  I know I can go in and add current.variable = producer.variable; to the record producer but I'm curious if there is an easy way to add ALL of the variables from the catalog item to the description field of an Incident. 

1 ACCEPTED SOLUTION

I'm using the catalog item/workflow to generate the Incident.  I got it to work by just coding it all out in the "Create Task" script field as follows:

task.caller_id = current.variables.requester_name.getDisplayValue();
task.short_description = current.variables.issue_type.getDisplayValue();

var issueType = current.variables.issue_type.getDisplayValue();

if (issueType == 'Outlook Problem') {
task.description = 'Issue Type: ' + issueType + '\nOutlook Problem: ' + current.variables.outlook_problem.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Computer Problem') {
task.description = 'Issue Type: ' + issueType + '\nComputer Problem: ' + current.variables.computer_problem.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Unable To Scan Docs') {

task.description = 'Issue Type: ' + issueType + '\nUnable to Scan Docs: ' + current.variables.unable_to_scan.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Internet Browser Problem') {

task.description = 'Issue Type: ' + issueType + '\nBrowser Problem: ' + current.variables.browser_problem.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Unable to Login to access.fnf.com') {

task.description = 'Issue Type: ' + issueType + '\nUnable to Login to access.fnf.com: ' + current.variables.unable_to_login_to_access_fnf_com.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Printer or Copier Problem') {

task.description = 'Issue Type: ' + issueType + '\nPrinter or Copier Problem: ' + current.variables.printer_copier_problem.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Application Specific Issue') {

task.description = 'Issue Type: ' + issueType + '\nApplication Specific Issue: ' + current.variables.app_specific_issue.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Desk Phone Issue') {
task.description = 'Issue Type: ' + issueType + '\nDesk Phone Issue: ' + current.variables.desk_phone_issue.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Wi-Fi Issue') {
task.description = 'Issue Type: ' + issueType + '\nWi-Fi Issue: ' + current.variables.wifi.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Mobile Device Issue (cell phone, ipad, tablet)') {
task.description = 'Issue Type: ' + issueType + '\nMobile Device Issue (cell phone, ipad, tablet): ' + current.variables.mobile_device.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'VPN Issue') {
task.description = 'Issue Type: ' + issueType + '\nVPN Issue: ' + current.variables.vpn.getDisplayValue() + '\nAdditional Information:' + current.variables.additional_information;
}

else if (issueType == 'Other Issue') {
task.description = 'Issue Type: ' + issueType + '\nAdditional Information:' + current.variables.additional_information;
}

 

Lots more coding then might of been necessary probably but it seems to be working for what we need it for.

View solution in original post

14 REPLIES 14

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Have a look at this thread I answered a week ago. A similar question and marked correct:
https://community.servicenow.com/community?id=community_question&sys_id=7a993976dbf5f3c04819fb243996...

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Ok, great.  Would this work in the "script" section of the "Create Task" workflow activity in my workflow?  I have 2 separate paths depending on what the user selects... one path creates incidents(which is what I need this script for) and one path creates normal SCTASKs.  

Hi there,

Not sure what your workflow looks like. Though, we do use workflows where we set the description thru Run Script activity. So theoretically, yes should work 🙂

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Just verified: It should work on the Script field in the Create Task utility. Just give it a try.

If you are having trouble getting the code right with using my suggestion, just share your code so far here and I can have a look.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn