- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 10:26 PM
Hi ,
Requirement: Sc request raised by using Scripted rest api script and Variables also should be passed.
I am trying using to use out of the box — Buy Item(Service Catalog Api) Script in custom Scripted Rest resources but getting errors .
kindly help to create new custom api by using out of the box api script .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 07:44 AM
Hi @naveenreddy0871 ,
you can use script like below. You need to query the record sys id and then pass.
var mgr = new GlideRecord('sys_user'); mgr.addQuery('name', manager); mgr.query(); if (mgr.next()) { var managerSysID = mgr.sys_id; cart.setVariable(item, "requested_for_manager", managerSysID); //here it is a reference field }
Please accept the solution if it helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 07:44 AM
Hi @naveenreddy0871 ,
you can use script like below. You need to query the record sys id and then pass.
var mgr = new GlideRecord('sys_user'); mgr.addQuery('name', manager); mgr.query(); if (mgr.next()) { var managerSysID = mgr.sys_id; cart.setVariable(item, "requested_for_manager", managerSysID); //here it is a reference field }
Please accept the solution if it helped.