Pre-fill table field with variable

samuelscott
Tera Expert

Hi guys!

I recently created several items that share the same variable set. All these items belong to the "sn_sm_legal_request" table. Anyhow, I'm consequently going to have to create several reports and analysis using the values from the variable set (which is not possible). What I'm hoping to do and make work is create new columns in the "sn_sm_legal_request" table and fill it with the values inserted into the variables by the user. For example, the variable "country" (variable name) belongs to a variable set and whenever a user fills a form and fills up the "country" variable, I want the newly created column's field "u_country" (from "sn_sm_legal_request") table to be filled. After all, I will now be able to create reports using the values off the table. I've been trying to use business rules but it isn't working. Any ideas?

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Samuel,


Please see this quick paragraph:


http://wiki.servicenow.com/index.php?title=Record_Producer#Populating_Record_Data



If you assign the name attribute of your variables to the same column name of the fields on your sn_sm_legal_request table, then the record producer will automatically populate those fields with the variable value.   So in other words no business rule or workflow is necessary.


View solution in original post

5 REPLIES 5

vinothkumar
Tera Guru

Hi Samuel,



Hopefully business rules will have to work, if it is correctly configured.



You can also update the same using the catalog item workflow itself by using a run script activity in the workflow, so that you can glide the particular table and set the current variable value to the particular field name.



Please let me know if you need any help on this


Thank you for your answer Vinoth.



The things is: my items use a model-->template and there is no workflow assigned since there are no tasks applicable. I could create a small workflow with a run script activity just to fill the country value in the table. However, I prefer using a business rule since I know its probably "best practice" but I don't know how to get the variable value and place it in the table field value (codingwise).



Thanks!


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Samuel,


Please see this quick paragraph:


http://wiki.servicenow.com/index.php?title=Record_Producer#Populating_Record_Data



If you assign the name attribute of your variables to the same column name of the fields on your sn_sm_legal_request table, then the record producer will automatically populate those fields with the variable value.   So in other words no business rule or workflow is necessary.


It works! Thanks Michael. This is basically "mapping" a variable from a variable set to a field in the record producer table.