The CreatorCon Call for Content is officially open! Get started here.

Reference field value is coming but which is not visible

Mani60
Tera Contributor
Hi All, I have written one scripted rest API for creating a new Request, and i have tested via postman and new Request has been created and also RITM, but in Req and RITM form the reference field (ex: company, department) name are poputing but these are not visible Please find the attached scripted rest API code: (function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) { var error = ''; var catItem = ''; var cat = new GlideRecord('sc_cat_item'); if (cat.get('name', 'New Hire/Transfer')) { catItem = cat.sys_id; } var cart = new Cart(); var item = cart.addItem(catItem); cart.setVariable(item, 'company', request.body.data.company); cart.setVariable(item, 'existing_department', request.body.data.existing_department); var cartGR = cart.getCart(); cartGR.update(); var rc = cart.placeOrder(); response.setBody({ result: 'Catalog Item request' + rc.number + 'created.' }); })(request, response); Please help me how can I get these fields values visible. Thanks,
11 REPLIES 11

DanielCordick
Mega Patron
Mega Patron

What do you mean by they are populating but not visible? Where are they not visible? 

 

If you submit the car item from the portal are the variables visible on the RITM?

Hi @DanielCordick Thanks for replying
reference field value not populating when i send the some value from postman integration,
please find the attached snapshot

Mani60_0-1691383642902.png

 

Please help me how can I get these fields values visible.
Thanks,

What are the values you are sending with 

request.body.data.company & request.body.data.exsisting_department

Hi @DanielCordick 

I have written below scripted rest API :
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response)

{

var error = '';

var catItem = '';

var cat = new GlideRecord('sc_cat_item');

if (cat.get('name', 'New Hire/Transfer')) {

catItem = cat.sys_id;

}

var cart = new Cart();

var item = cart.addItem(catItem);

cart.setVariable(item, 'company', request.body.data.company);

cart.setVariable(item, 'existing_department', request.body.data.existing_department);

var cartGR = cart.getCart();

cartGR.update();

var rc = cart.placeOrder();

response.setBody({ result: 'Catalog Item request' + rc.number + 'created.'

});

})(request, response);
we have sending "company" name and "department" name both variable are reference field

so could you please me how can I those value in that field.