Auto-populate the short description field with two fields from record producer

scottn
Mega Expert

You guys were incredibly helpful with my last question, so I'm hoping this one is easy too.   🙂

I am using the following record producer:

servicenow.jpg

When the user submits the form, I would like to autopopulate the short description field with the OUC field and the "Type of Document" field. So the short description would end up looking similar to these:

110119 Voucher

or

110150 Pcard

I'm lost as to what the code should look like and actually where it should reside as well. I feel like I'm so close to being done with this project, so any help would be greatly appreciated.

Thanks in advance!

Scott

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Scott,



Your record producer code would go in the script field on your record producer and be something like the following. I'm not sure what your variable names are for the two variables, though, so you'll need to look those up and replace.



current.short_description = producer.ouc + ' ' + producer.type_of_document;


View solution in original post

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Scott,



Your record producer code would go in the script field on your record producer and be something like the following. I'm not sure what your variable names are for the two variables, though, so you'll need to look those up and replace.



current.short_description = producer.ouc + ' ' + producer.type_of_document;


That'll serve me for grabbing a thirst quencher between responses.


Thank you, that worked!!!


Uncle Rob
Kilo Patron

So the first thing you need to know is the NAME's of those two variables.   I'm going to assume ouc and type are the names.



Now all you need:



current.short_description = producer.ouc + " " + producer.type;




Record producer is awesome since you can use any of the variables by typing producer.<variablename>.   Its DOUBLE awesome in that any variable that is named *exactly* the same as a field on the destination table will automagically populate the data there without you commanding it to.