- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 11:17 AM
I have a workflow on the sc_req_item table and the workflow has a script activity. In the script activity, I am trying to copy the value of the "short description" variable to the short description field of the parent Request.
I tried this with no luck.
sc_request.short_description = current.variables.short_description;
All help is appreciated!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 12:16 PM
Shane. My bad
Here is the updated script.
- //This function will be automatically called when this rule is processed.
- var gr = new GlideRecord('sc_request');
- gr.addQuery('sys_id',current.request);
- gr.query();
- while(gr.next())
- {
- gr.short_description = "Is this working?!"; //assuming short_description is the varaible part of catalog item
- gr.update();
- }
There was error on 2nd line. Try now pls.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 11:22 AM
Hi Shane,
You should have the script as.
var gr = new GlideRecord('sc_request');
gr.addQuery('request',current.request);
gr.query();
while(gr.next())
{
gr.short_description = current.variables.short_description; //assuming short_description is the varaible part of catalog item
gr.update();
}
I hope this answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 11:49 AM
Pradeep,
Thank you for the quick reply. The workflow is processing the activity, but is not changing the Request short description. Rather, it is keeping the short description which is the name of the catalog item. I don't see any issues that are causing it not to work.
My goal is to:
- Trigger the 1st workflow off the Request table which verifies that "Short description is Generic IT Request" .....WORKING
- After #1 runs, update the Request short description with the Item variable short description....NOT WORKING
I have a business rule that is copying the Item variable short description to the Item short description....WORKING.
Basically, I need my Generic IT Request catalog item to skip the approval state (working by verifying short description of Generic IT Request) and then set the Request short description to what the user enters into the Item variable short description (which I am also copying to the Item short description in the above mentioned business rule)
I also tried to modify the IF activity that's running off the Request table to say if catalog item is Generic IT Request, but it would let me choose that in the drop-down so that's why I am keying off of short description.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 11:54 AM
Hi Shane,
Thanks for the update. I am assuming that you are running the script on the worklow on table sc_req_item.
Just for testing purpose hardcode the short description and check if script is working fine or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2015 12:14 PM
Pradeep,
I tried the script below and it did not work; kept the catalog item name as the short description. I don't know how to script so I trial and error while putting various pieces together so let me know if this is wrong.
//This function will be automatically called when this rule is processed.
var gr = new GlideRecord('sc_request');
gr.addQuery('request',current.request);
gr.query();
while(gr.next())
{
gr.short_description = "Is this working?!"; //assuming short_description is the varaible part of catalog item
gr.update();
}
Shane