Automatically update the short description in request, ritm and sctask?

Moedeb
Tera Guru

This question has been asked and answered in the past (even by myself), however I have tried all those and they are not working for me at all.

What I want should be fairly simple I would think. I have a Catalog Item with a select box and in that it decides the type of request that it is going to be, all I want is for the short description for the Request, Requested Item and the Task to be the same, but to use field contents to assist with making them mean something when looking through a list of them.

find_real_file.png

So as I've shown in the screen shot, something like this:

- Request creation of a [account_name] for [user_name].

I would really appreciate some help with this, thanks

 

1 ACCEPTED SOLUTION

Raf1
Tera Guru

Hi Moe,

You can try the following:

1. For updating RITM short description, you can use a before business rule on sc_req_item table and use this line in the script:
current.short_description= 'Request creation of a ' + current.variables.<account name variable name> +' for ' + current.variables.<users variable name> +


2. For updating the Request short description, You can add a runscript in the workflow mapped to a catalog item like:

var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id', current.request);
gr.query();

if(gr.next())

{

gr.short_description = current.short_description;
gr.update();


}

 

3. For updating the task short description, In the same workflow at the catalog task activity you can add the following scripts:

Advanced section:
task.short_description = current.short_description;

 

Regards,

Raf

View solution in original post

8 REPLIES 8

Raf1
Tera Guru

Hi Moe,

You can try the following:

1. For updating RITM short description, you can use a before business rule on sc_req_item table and use this line in the script:
current.short_description= 'Request creation of a ' + current.variables.<account name variable name> +' for ' + current.variables.<users variable name> +


2. For updating the Request short description, You can add a runscript in the workflow mapped to a catalog item like:

var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id', current.request);
gr.query();

if(gr.next())

{

gr.short_description = current.short_description;
gr.update();


}

 

3. For updating the task short description, In the same workflow at the catalog task activity you can add the following scripts:

Advanced section:
task.short_description = current.short_description;

 

Regards,

Raf

Thank you for your reply - I've only tested the RITM part so far and have it working, apart from adding in the requester's name.

Is there a way to automatically add the currently logged in users full name (EG: Joe Bloggs) to the short description without needing to have a reference field on the portal form?

 

Hi Moe,

You should be able to use :

gs.getUserDisplayName();

More information on the link below:

https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GS-getUser

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

 

If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.

 

Thanks,

Raf

Yep that worked nicely thank you, I'll certainly mark as correct once I've tried each of them out, thanks for your help.