- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2018 01:30 AM
Hi Experts,
I have designed a workflow for ordering Software. The process is that it opens a request item then an RITM.
I am facing a problem that whenever I request for a software, it opens two workflows for a service Request, one is oob workflow Service Catalog Request, and my designed workflow SC-Software Request wf. As a result it automatically sets the Approval value as Approved due to the oob process Runs.
I am unable to separate it. I want only my designed SC-Software Request wf to Run. The only method is to quote a price of the software I think which If I increase more than $1000, then it will not set the value automatically to be approved. Is there a way I only want my workflow to Run for this Request.
Regards,
Raju Singh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 03:19 AM
Use below
var title = '';
var desc = '';
var ritem = new GlideRecord('sc_req_item');
ritem.addQuery('request',current.sys_id);
ritem.query();
while (ritem.next())
{
if (title=='')
{
title = ritem.cat_item.getDisplayValue();
desc = ritem.cat_item.category.getDisplayValue();
}
else
title = title + ','+ritem.cat_item.getDisplayValue();
desc = desc+','+ritem.cat_item.category.getDisplayValue();
}
current.short_description = title;
current.description = desc;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2018 09:00 AM
You can write a business rule on Request table to fill it. It should be an Before, OnInsert, OnUpdate BR.
var title = '';
var ritem = new GlideRecord('sc_req_item');
ritem.addQuery('request',current.sys_id);
ritem.query();
while (ritem.next())
{
if (title=='')
{
title = ritem.cat_item.getDisplayValue();
}
else
title = title + ','+ritem.cat_item.getDisplayValue();
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 10:53 PM
Hi Sanjiv,
Thank you for your help!!
I would like to update you that I am looking for a Service Request ( sc_req) and not the Service Request Item (sc_req_item). I need to put the query on the Service Request as the approval is getting added in the Service Request when we place a Request based on the catalog item. My Service request atomatically gets approved as the oob conditon for the request gets approved when the price<$1000. How do I get rid of this condition for my software request for my Service Request (sc_req)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 11:12 PM
You need to add a condition in the OOB workflow to not run for your software request.
To do that I wanted you to add a business rule on request table, which will update the request with the request item name.
And then you need to add a condition in the OOB workflow that shprt_description does not contain your software catalog item.
By the way, on what condition are you running the software workflow?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 11:42 PM
Hi Sanjiv,
Thanks for your answer.
I tried your code but it doesn't work. A small change I did was instead of
if (title=='')
I have written as short_description as I do not have 'title' field in my sc_req table
The condition for which I want to run the software workflow is when the Service Catalog Category Title is 'Software request' . My requirement will be resolved if somehow I get to populate the Description or short description with the name of the catalog item so that I could put the conditon if the short description == 'Software request.
Is there a way of populating short description of the Request based on the catalog item which we selected from the category Title is Software request.
Attached are the screen shots for your reference.
This is the business Rule code I tried for sc_req table
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var short_description = '';
var ritem = new GlideRecord('sc_req_item');
ritem.addQuery('request',current.sys_id);
ritem.query();
while (ritem.next())
{
if (short_description=='')
{
short_description = ritem.cat_item.getDisplayValue();
}
else
title = title + ','+ritem.cat_item.getDisplayValue();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 11:45 PM
I can see that the short description of the sc_req_item field gets populated with the catalog item name... Similarly, can we populate the short description of the sc_req table