I want to add the below two sys_id in the property and call the property inside the encoded query

Pooja Khatri
Tera Contributor

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 : 

 

 var grUser = new GlideRecord('sys_user_group');
    grUser.addEncodedQuery("typeLIKEfe0c590fc9d3f0003c0953598e8a66eb^ORtypeLIKE0248ea58c92ff0003c0953598e8a6616^sys_id=" + current.u_lob.toString());
    grUser.query();
    if (!grUser.next()) {
        gs.addErrorMessage(']LOB should always be of type lob or lob_internal');
        current.setAbortAction('true');
    }
11 REPLIES 11

Abhishek_Thakur
Mega Sage

Hello @Pooja Khatri ,

 

You can add the create new property by providing the same encoded value in the value field on the form and call that property in your script.

 

 var grUser = new GlideRecord('sys_user_group');
var prop_value = gs.getProperty("property_name");
    grUser.addEncodedQuery(prop_value+ current.u_lob.toString());
    grUser.query();
    if (!grUser.next()) {
        gs.addErrorMessage(']LOB should always be of type lob or lob_internal');
        current.setAbortAction('true');
    }
 
Please accept my solution and give thumbs up, if it helps you.

 

 

 

Hi @Abhishek_Thakur - should I store the value = typeLIKEfe0c590fc9d3f0003c0953598e8a66eb^ORtypeLIKE0248ea58c92ff0003c0953598e8a6616 in the property ?

Hello @Pooja Khatri ,

 

Yes, you need to store the encoded query in the property and use the below script.

 

 var grUser = new GlideRecord('sys_user_group');
var prop_value = gs.getProperty("property_name");
    grUser.addEncodedQuery(prop_value+ current.u_lob.toString());
    grUser.query();
    if (!grUser.next()) {
        gs.addErrorMessage(']LOB should always be of type lob or lob_internal');
        current.setAbortAction('true');
    }
 
Please accept my solution and give thumbs up, if it helps you.

Hi @Abhishek_Thakur  - ok I am trying give me a minute