Get Sys_id from Glide table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 08:21 AM
Hi community,
I have a use case, where unable to found the how to get sys_id of "assigned_to" field from "cert_element" table and make it applicable on "sc_request", Requested for variable.,
Iam uisng Cart API method for creation of request, request was created but need to update variable "Requested for" with the specific assigned user who belongs to table "cert_element" , any one help will me with!!
Thank you!!
PFA BR,
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('bcda93ed97652510d4e230471153aff3');
var mgr = new GlideRecord('cert_element');
mgr.addEncodedQuery('audit=bb50507997102110912ef8b3f153afee^stateINCertified,Failed'); // Matcing condition to trigger
mgr.query();
if (mgr.next()) {
var sysid = mgr.current.assigned_to; // trying to pull sys_id of user who was assigned.
}
var rc = cart.placeOrder();
var reqRecord = new GlideRecord('sc_request');
reqRecord.get(rc.sys_id);
reqRecord.requested_for = 'sysid';
reqRecord.update();
gs.addInfoMessage(rc.number);
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 08:25 AM
Hi @Jogam Anvesh ,
Try below:
var itemID = current.sys_id;
var ts = new GlideRecord('sys_atf_test_suite');
ts.get('u_suite_id',itemID);
action.setRedirectURL('sys_atf_test_suite.do?sys_id=' + ts.sys_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 09:51 AM
Hi sandeep, Thanks for responding!!
I am elaborating the use case mentioned, Here i need to pick the sys_id of (assigned user) which is the value of reference field "assigned to" on "cert_element" table and then need to use on "requested for" variable on item,
In script iam trying to implement that once the request was created,
Example:
on "cert_element" record assigned to field = Alexander, after the request generated need to popup "Requested for" variable = Alexander