sc.CartJS() Unable to find workflow version

Dotaz
Tera Contributor

Dear all,

I have an issue when creating a request record and RITM when using sn_sc.CartJS()

var cart = new sn_sc.CartJS();
var newItem = cart.addToCart({
"sysparm_id": "017594ae0ff25b00a919f68ce1050e04",
"sysparm_quantity": "1",
"sysparm_requested_for": "a29b5e74db18f8507ad764ebd3961902",
"variables":{
}
});
var checkoutInfo = cart.checkoutCart();

Getting error:
Unable to find workflow version for 73017d1037023000158bbfc8bcbe5dce (user=14ad7908dbe615107ad764ebd39619e7)


The workflow is in the true state.

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Dotaz 

are you saying when RITM gets created using the above script the workflow is not triggering?

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

Hi Ankur,
ty for your answer.
yes, that is correct.

Dotaz_0-1677138946852.png

 

 

@Dotaz 

I hope you have linked the workflow to your catalog item and it's in Published state

can you try to use cart API

try{

	var cartId = GlideGuid.generate(null);
	var cart = new Cart(cartId);
	//add your requested item to the cart by sys_id of the catalog item
	var item = cart.addItem('017594ae0ff25b00a919f68ce1050e04', 1);
	cart.cart.requested_for = 'a29b5e74db18f8507ad764ebd3961902';
	var rc = cart.placeOrder();
	gs.info(rc.number);

}
catch(ex){
	gs.info(ex);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

Thank you for your quick response.

Yes, this is working fine. This method, however, will be deactivated by ServiceNow.
Therefore sn_sc.CartJS(); ,which does not work.