How do I dynamically modify RITM & TASK short descriptions based on Catalog Item short desc. & cat item form variable?

GoBucks
Mega Sage

I'm trying to find a way to dynamically modify the short description for the related RITMs and TASKs records that get created when an REQ is created from submission of a Catalog Item form.

 

For example, we have a Catalog Item named "Event Request" that has a defined short description of "Event Request" in its short description field.   The REQ that gets created from submission of this cat item form has one related RITM with one related TASK, where each of the short description fields of the RITM & related TASK simply state the same short description of "Event Request".

 

So, currently when one looks at their assigned TASKS that originated from this catalog item they'll see in the list view short descriptions looking like this:

TASK0000001 - Event Request

TASK0000002 - Event Request

TASK0000003 - Event Request

Hard to differentiate at a glance.

 

This particular catalog item form contains a variable, event_name, where the user enters the name of the event.   It would be preferable if prior to insert of these RITMs & TASKs if their short descriptions could be modified to be the original short description (from the Catalog Item's short description) plus the value of the event_name variable the user submits on the form.

 

If the above mentioned modification could happen, a list view with unique short descriptions for each TASK could be possible:

TASK0000001 - Event Request: Annual Tech Conference

TASK0000002 - Event Request: monthly budget meeting

TASK0000003 - Event Request: holiday party

Much easier to differentiate at glance.

 

Essentially... short_description + ": " + event_name but how can this be achieved?

 

Business Rule/event, or client-side script via onSubmit()?   As I'm relatively new to the scripting aspects within Service Now I'm not exactly sure how this can be achieved.

 

Thanks in advance!

Jeff

1 ACCEPTED SOLUTION

david_legrand
Kilo Sage

Hi Jeff and Justin,



If you're creating the task using the workflow editor, I would rather use the "advanced script" on the task creation:


find_real_file.png



task is the sc_task I'm creating, current is the sc_req_item


This way you'll save not necessary database updates and your workflow will be easier to understand



But that don't tell you why using Business Rules, Client Scripts or the workflow directly as here


View solution in original post

11 REPLIES 11

Just pointing out that the correct answer is correct at the time of creation, if you wanted to perform this update after you had already created all of the tasks, then you could have a Business Rule running watching for the change to the REQ (or RITM) and then cascade that change down to all of the "children".



We did something recently like this when we wanted the Requested for to be updated on the parent, and then have that drive down through all of the associated RITM and TASK records.


saurabhverma
Mega Contributor

in case of RITM-


simply use the run script in the workflow and use the code


current.short_description='what you want to set the value in the short description field';



in case of task-


use the below code in advanced of the task


current.short_description='what you want to set the value in the short description field';