Can we use CART API for Record Producers?

Sumit Pandey1
Kilo Guru
Kilo Guru

I want to use CART API to submit a record producer, Is Cart API only available for Catalog Items?

9 REPLIES 9

Harsh Vardhan
Giga Patron

No , you can not.

 

you can use rest API here and then service catalog API 

HI article for further details. 

 

https://hi.service-now.com/kb_view.do?sysparm_article=KB0686272

Sumit Pandey1
Kilo Guru
Kilo Guru

Hey @Harshvardhan  and @Mark Roethof ,

Thanks for responding!!

If not CART API, what else I can use to make it look like that the records are created from Portal?

Say, I am doing POST Call from POSTMAN, but record being created should look like its created from Record Producer, Any way I can achieve that.

I am willing to explain my full business use-case if required.

Thanks.

yes you can achieve it .  

i am assuming here you just need to know if the record producer has been submitted from portal or not. here we will use sp_log table. 

 

if yes follow the below step. 

 

Create one event here 

Go to module system policy >> Events >> registry. 

Screenshot for reference. 

 

find_real_file.png

 

Now create one script Action:

Go to module system policy >> Events >> Script Actions

 

var ID = event.parm1;

var grsp =  new GlideRecord('sp_log');
grsp.addEncodedQuery('type=Task View^id='+ID);
grsp.query();

if(grsp.getRowCount() >0){
	var gr = new GlideRecord('incident');
	gr.get(ID);
	gr.work_notes = 'Record as been created from portal RP';
	gr.update();
}

 

find_real_file.png

 

 

Now create one before business rule on incident table to trigger the eventQueueScheduled(). 

 

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



	// Add your code here
	var gdt = new GlideDateTime(); 
	gdt.addSeconds(4); 

	gs.eventQueueScheduled('rp.portal',current,current.sys_id,'Scheduled ' + gdt.getDisplayValue(),gdt);


})(current, previous);

 

Note: Now whenever you will submit the record producer from portal, incident work notes will get updated . you can set the field value as well eg: contact type as service-portal .

 

Hope it will help you. 

 

If my answered helped you , kindly mark it as correct and helpful. 

Sumit Pandey1
Kilo Guru
Kilo Guru

That was very interesting Harsh, but that is not what I am after. I want something for record producer what CART API does.

 

CART API wont work for record producer. 

 

what is your business need?