Software request triggers the two workflows, how shall I trigger only my workflowfff

Raju Singh1
Tera Expert

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.

Capture1.JPG

Capture2.JPG

Capture3.JPG

Regards,

Raju Singh

1 ACCEPTED SOLUTION

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.

View solution in original post

23 REPLIES 23

Oh!! That was so stupid of me!!



Thanks Sanjiv.... it works now..



However, Is there a way of populating the Description value as the Service Catalog category as well. Here in my case the Category is Software Requests. Somehow if I manage to populate this Description value as Software Requests. I would be able to use this description value to write my condition   for which workflow shall I Run.   If I Use the short description, then I may have to write too many conditions for my short description for my workflow to run.



Hope you understand my requirement.



Capture9.JPG


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.

Thanks a Ton Sanjiv.. It worked.. You just came like a saviour.. I truly appreciate the help you provided. I really struggle in this servicenow coding and it becomes difficult to relate. Is there any reference material which you could suggest me to study which may help me in coding in ServiceNow.



Just wanted to update that description was populating two times as 'Software Requests,Software Requests. So, I removed   2nd desc from else condition so, my else conditon is just



else


                  title = title + ','+ritem.cat_item.getDisplayValue();



and it works properly now.



                 


You can go through the below thread. This could be helpful.



Learning ServiceNow from Scratch and Prepping for the Certification Exam



Also can you mark my response answered if it worked for you.



Please mark this response as correct or helpful if it assisted you with your question.

Thank you my friend Sanjiv.



You have really me helped a lot. Salute you!!   You are the man and need of an hour!!



Your help is very much appreciated!!



Regards,


Raju Singh