Dynamically set the RITM short Description

kerr_jamese
Tera Contributor

Hello helpful community,

 

I searched the community and there is a post that starts very similarly to my question but goes in a different direction called "How do I dynamically modify RITM & TASK short descriptions based on Catalog Item short desc. & cat item form variable?"

 

Or maybe it's the same…

 

What I am trying to do is set the RITM short description on submit from a variable on the previous form.

 

I want the RITM to be created and the Short Description to say the the Catalog Item Name + the Variable field value... so this maybe?

Code.png

RITM.png

 

It looks like the answer in the other post is going into the workflow and populating variable from the task level, but that's too late… the RITM is already created… right?

 

I too have no technical background and don't know how to write JavaScript but am trying to learn.

 

I appreciate your assistance!

 

James.

9 REPLIES 9

Hi James,



I think there's a bit of confusion as the answers here have referred to the ritm, or sc_req_item table, but your screenshot is referencing the sc_cat_item table. The two tables are different. sc_cat_item is the table where you define all of the available catalog items people can order. sc_req_item is the table where each record is an instance of the ordered item and I think this is the table that you're interested in.



A before insert business rule will work on sc_req_item and you don't need the current.update() line in that. The issue with it is it will run on all items that get requested, so if only one or a subset of your items will have an employee_name variable you'll want to use the workflow script so you can target those specifically. In that case you can use the same code from your business rule screenshot.


girish_deshpand
Giga Contributor

Workflow will always help you to achieve what you want



add a run script in workflow and then add above mentioned code


Does this still work? I haven't had any luck with the run script in the workflow.


I commented out the additional variables so I can start simple for troubleshooting.


Capture.PNG


Brad Tilton
ServiceNow Employee
ServiceNow Employee

That should work unless you have some sort of business rule on the sc_req_item table changing it back.


Hmm, even if i leave the   description blank   on the item itself it doesn't seem to take. I'll have to see, is it that way OOB?