Record Producer script

lukejames1uk
Kilo Explorer

Hi there

I have a record producer form as one of our service catalogue items. I need to get some of the populated variable information into the title or short description. Does anybody know how to do this?

Regards

Luke

6 REPLIES 6

nikita_mironov
Kilo Guru

Hi
Refer to http://wiki.servicenow.com/index.php?title=Record_Producer#Populating_Record_Data and use Script in Record Prodcer to define the logic of target record population.

Example: suppose I have record producer form variables named var1 and var2 and I want to concatenate them in target task record short_description field. In this case the script will be the following:
current.short_description = producer.var1 + producer.var2;
of course you wight want to check var1 and var2 for null values beforehand. That can be done in the same Record Producer script code.

Record producer allows to map record producer variables to target record fields (available in record producer related list). Note that script overrides those mappings (executed after mapping jus before saving a new record).

Hope this helps.


Thanks Very much i have been able to populate the field i wanted to now.

Very Much appreciated.

Thanks Again.

Luke


this is just what I was looking for however when I run the script it concatenates the two fields, in your example var1 & var2 together without putting a space between the two, ie var1var2. what do i need to add to the script to get a space between them, ie var1 var2?


Stig Brandt2
Mega Expert

Hi

I have a record producer, generating variables and values in the change variabel field!

My record producer is
- creating a change request
- the request is to build a new server, so my variables is information to build the
server, such as hardware, os, ip etc.

Now I want as a change manager to "create" an ci_server record using these variables and then
add tasks for this ci_server record.

Is this possible?
thanks
Stig