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.

Access variable in RITM from Record producer flow

gdo
Tera Contributor

Dear community,

Is it possible to bring the variables of my form to the RITM using a record producer ?
I need to create CASE + Service Request
I decided to create case from record producer and use a flow to create SR but I can't see the variables like this :

gdo_0-1764239085433.png

Any suggestions or other way to have case + sr creation best practice ?

Regards,

4 REPLIES 4

Sarthak Kashyap
Mega Sage

Hi @gdo ,

 

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

 

In your record producer add below script 

var cartId = GlideGuid.generate(null);

var cart = new Cart(cartId); // core Cart server API

var cartItemId = cart.addItem('9583869893ed7a189305f520ed03d666'); // returns cart item id

cart.setVariable(cartItemId, 'description', 'Issue from API');

var result = cart.placeOrder(); // result often contains request info / ids
gs.info('placeOrder result: ' + JSON.stringify(result));

SarthakKashyap_0-1764241839268.png

 

 

My Variable 

SarthakKashyap_1-1764241868007.png

Result 

Once I submit it 

SarthakKashyap_2-1764241892793.png

Target record got created

SarthakKashyap_3-1764241919474.png

 

Also RITM created 

SarthakKashyap_4-1764241955861.png

 

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

Thanks and Regards,

Sarthak

Ankur Bawiskar
Tera Patron
Tera Patron

@gdo 

Variable editor on RITM will only show variables if your current RITM is submitted as part of Catalog item.

You can use "Submit Catalog Item Request" flow action and it will generate Service Request (REQ and RITM)

Submit Catalog Item Request action 

You can submit a record producer using script as well

see these links

How to Submit record producer using script ServiceNow 

Submit the record producer from script 

CatItem - Scoped 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes it should be right indeed. 
The problem now is how the record producer should trigger the flow ? 
for now is 

gdo_0-1764246157720.png



But the record producer creates a Case and the flow is not being trigger 😞

gdo
Tera Contributor

With that trigger the system await a RITM to be submitted but its a case being created by record producer