Using Variables in Incident

hartr
Giga Contributor

I would like to collect some additional data when logging Incidents for certain kinds of CI's.

I would like to prompt the Service Desk analyst for the additional data and then append or prefix the results to the description field. Can I use variables or do they only work against Catalog Items ?

I don't want to store the data in dedicated fields as it won't be used for reporting and I don't want to fill the table with fields that are only used occasionally.

Thanks

3 REPLIES 3

Jared_Laethem
ServiceNow Employee
ServiceNow Employee

In order to use variables with tasks the tasks must be created by a record producer. So if your techs already use a record producer when they create incidents great, otherwise I would recommend just creating actual fields and then using UI policies or client scripts to hide them when conditions do not dictate their use.


Not applicable

Hi Jared, I am working with Russell on this requirement. We really want to avoid adding loads of fields to the table if we can, the purpose is really to gather ci or service specific data and append it all in the description field. What is it that a record producer does differently to allow us to use variables. Is this something we can trigger from 'incident.do' when they press create new? Or even use an interceptor in some way?
Cheers
Dave Pink


brozi
ServiceNow Employee
ServiceNow Employee

I think a good example of how a record producer allows you to use variables and add to a description field is with the "Reset a Password" record producer. If you take a look at the script you can see that it uses the variables to create the work notes. Your not adding those variables to the incident table, but you do need to create each variable.. 🙂

I think you have three options. ( i could be wrong there may be more...)

1. Use a Record Producer
2. Use an interceptor which would trigger from incident.do when creating a new record.
3. Use a wizard to ask the questions and produce your record

Either way all of the options would most likely use a script similar in nature to the one used for that record producer. Basically, using the variables to build out the description. Here is a an example of that script from the Reset a Password" RP.


var notes = "Please contact customer with new password via: " + producer.contact_me;
notes += "\nCaller : " + producer.caller_id.getDisplayValue();
notes += "\nSystem : " + producer.cmdb_ci.getDisplayValue();
notes += "\nContact : " + producer.contact_me;
current.work_notes = notes;
current.short_description = "Reset the password for " + producer.caller_id.getDisplayValue() + " on " + producer.cmdb_ci.getDisplayValue();