Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

When a variable is updated on the sc_req_item record, a new sc_task should be created in the Service

vikramteral
Giga Contributor

When a variable is updated on the sc_req_item record, a new sc_task should be created in the Service Catalog Task table.

I have try to create the flow designer sc_req_item Table is not showing in Trigger table. This should be automating any steps there please let me know.

vikramteral_0-1764350275630.png

 

3 REPLIES 3

jennifermetz1
Tera Expert

Hello @vikramteral,

 

You cannot reference the sc_req_item table directly when triggering in a flow. You need to use the service catalog as the trigger. 

 

Note: Service Catalog triggers do not support catalog variables as part of the trigger condition. Instead, get or create catalog variables in the main body of the flow.

 

Here is the documentation that should walk you through it:

Create a flow with a Service Catalog trigger

 

Hope this helps!

 

Jennifer Metz
Sr. ServiceNow Developer | Infosys

Amitra Bhunia
Mega Guru

Hi @vikramteral ,

 

Your trigger should be service catalog. PFB the sample flow configurations for catalog items:

AmitraBhunia_0-1764408693162.png

Please mark it correct or helpful if it really resolve your issue.

 

Regards,

Amitra

 

Sarthak Kashyap
Mega Sage

Hi @vikramteral ,

 

I tried your problem in my PDI and it works for me please check below solution


I created Before Business Rule which works on RITM table - sc_req_item and add below code 

SarthakKashyap_1-1764432446126.png

 

 

SarthakKashyap_0-1764432430927.png

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (current.variables.add_here != previous.variables.add_here) {
        var task = new GlideRecord('sc_task');
        task.initialize();
        task.request_item = current.sys_id;
        task.short_description = 'Task created because variable was updated';
        task.insert();
    }

})(current, previous);


Result

When I change value of variables task is created for me 

SarthakKashyap_2-1764432483702.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,
Sarthak