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

Jim Coyne
Kilo Patron

The RITM is created, but the Short Description can still be updated.   Doing it through the Workflow is the way to go.


ohhgr
Kilo Sage
Kilo Sage

Hi James,



The code that you've mentioned above should be enough to set the short_description of the Request Item. And also, if this code is added in the workflow, the short description will be overwritten rather that set by default.



In case you want the overwriting not to happen, you could add above line of code in a before insert business rule in the sc_req_item table. That will always set the short description before creation of the req item.



Please note, the business rule will always set the short description, so if you want it to be restricted to some catalog items only, you need to specify the conditions accordingly in the business rule.



Hope that helps


Mandar


kerr_jamese
Tera Contributor

Thanks Guys. In this case I will always want to set the short description so the route I will want to take is a Business Rule?



I am on Calgary, any assistance with writing the Business Rule would be appreciated as well. I literally created a before business rule on the sc_cat_item table and stuck the above code in and it didn't work... Do I need more? Do I need conditions?Business Rule.png



Or if the workflow is really recommended, could someone provided a scripting assistance as well?



James


Do you mean you want this to happen for ALL catalog items, or just this one in particular (or maybe a couple of them)?



As for your current Business Rule, never use update() in a Before Business Rule - that will be handled by the platform (see Business Rules Best Practices - ServiceNow Wiki).   Secondly, it should be running on the Requested Item table (sc_req_item).