Use REST API to Create Standard Change Request from Template and Set Fields

brenthubin
Tera Contributor

I am needing to create a Standard Change Request using an approved template and also be able to set some fields that are dynamic (such as the company and configuration_item fields). I'm able to create the Standard Change Request using the Service Catalog submit_producer API, but for some reason when I pass variables to it for any field it does not fill that field in.

I've tried this using the REST API Explorer with no success using the sn_sc namespace and OOB Service Catalog API and the Submit a Record Producer method. Screenshots of this are below. Note that I have indeed already tried specifying the sys_id for the reference fields. That isn't the problem.

Thank you for any assistance you can offer.

find_real_file.png

find_real_file.png

7 REPLIES 7

Prateek kumar
Mega Sage

How about instead of dotwalking use attributes to pass display values into the reference fields.

https://community.servicenow.com/community?id=community_question&sys_id=adc013a9dbdcdbc01dcaf3231f9619ef


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Prateek,

I think you missed the point. It doesn't matter whether I dot walk to pass the sys_id to the reference fields. It won't even fill in the fields that are not reference fields. It only fills in the fields that are populated by the template.

jxsaxton421
Tera Guru

Change Request is a separate table, not a service catalog, so you'd have to create a new endpoint for it. We just developed a Change Request API to accept an approved template. In your code when you insert into the table you just need to use the .applyTemplate method in gliderecord.

Oh, I'm sorry I see your code. Our approach was to do a gliderecord in a custom endpoint and parse the body ourselves.