I am not getting correct answer through encoded query in glide record

Murtaza Saify
Tera Contributor
function onLoad() {

    var gr = new GlideRecord('cmdb_ci');
    gr.getEncodedQuery('cost>10000');
    gr.query();
    var str;
    var count=0;
    while (gr.next()) {
        str = str+ ' and  ' + gr.name;
        count++;
    }
    alert(str);
    alert(count);

}
 
Here is my code  whats wrong with it
17 REPLIES 17

Amitoj Wadhera
Kilo Sage

Hi @Murtaza Saify ,

 

There is a syntax error in your code, use addEncodedQuery instead of getEncodedQuery.

Corrected code:

function onLoad() {

    var gr = new GlideRecord('cmdb_ci');
    gr.addEncodedQuery('cost>10000');
    gr.query();
    var str;
    var count=0;
    while (gr.next()) {
        str = str+ ' and  ' + gr.name;
        count++;
    }
    alert(str);
    alert(count);

}

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

Not able to get answer as I am trying to use it in client side

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Murtaza Saify ,

 

Glide record will not work on client script

 

I hope this helps...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

thanks for it but it is not giving me answer in client side