I want to add the below two sys_id in the property and call the property inside the encoded query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:24 AM
Hi All ,
I have a requirement where in my below script , I am passing two sys_id's in the encoded query ..
I want to store that sys_id in the property and call that property inside the encoded query in the similar manner.
How can I implement this with the below query :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:43 AM
Hi @Abhishek_Thakur - I am have written the below code , can you validate it once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:52 AM
Hi @Abhishek_Thakur - but as per the encoded query earlier :
grUser.addEncodedQuery("typeLIKEfe0c590fc9d3f0003c0953598e8a66eb^ORtypeLIKE0248ea58c92ff0003c0953598e8a6616^sys_id=" + current.u_lob.toString());
I am not calling the sys_id in the property , the property looks as below :
typeLIKEfe0c590fc9d3f0003c0953598e8a66eb^ORtypeLIKE0248ea58c92ff0003c0953598e8a6616
so to pass that sys_id I have called the encoded query in the below pattern :
grUser.addEncodedQuery("grProperty^sys_id=" + current.u_lob.toString());
how and where to store that sys_id value ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:55 AM
Hello @Pooja Khatri ,
You have already added that value in property. So, you don't need to add the sys_id again. Just use my script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 01:36 AM
Hi @Pooja Khatri ,
I guess instead of property you mean variable right?
You could define the sys_ids into variables and concatenate the variables into the encoded query:
// Define variables to store the sys_id values
var sysId1 = "fe0c590fc9d3f0003c0953598e8a66eb";
var sysId2 = "0248ea58c92ff0003c0953598e8a6616";
// Construct the encoded query using the variables
var encodedQuery = "typeLIKE" + sysId1 + "^ORtypeLIKE" + sysId2 + "^sys_id=" + current.u_lob.toString();
var grUser = new GlideRecord('sys_user_group');
grUser.addEncodedQuery(encodedQuery);
grUser.query();
if (!grUser.next()) {
gs.addErrorMessage('LOB should always be of type lob or lob_internal');
current.setAbortAction('true');
}