Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

please let me know any mistake in below code

mani55
Tera Contributor

please let me know any mistake in below code because still it's not working

var reqfor = ritm.variables.requested_for;
    var query = 'model.short_descriptionINSFW100,SFW102^install_status=1^assigned_to=' + reqfor;

    var grService = new GlideRecord('u_alm_service');
    grService.addEncodedQuery(query);
    grService.query();
    if (grService.next()) {
        var ci = new GlideRecord('u_cmdb_ci_service_github_subscription');
        ci.addQuery('assigned_to', grService.assigned_to);
        ci.query();
        if (ci.next()) {
            ci.u_msdn = true;
            ci.update();

        }

    }
4 REPLIES 4

vaishali231
Mega Sage

@mani55 
Could you please share what is your requirment  ?

Ankur Bawiskar
Tera Patron

@mani55 

model field name is correct within the table u_alm_service?

Should it not be u_model since it's a custom table?

assigned_to is correct field within table u_cmdb_ci_service_github_subscription

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

@mani55 

Did you check the above points?

Tanushree Maiti
Tera Patron

Hi @mani55 

 

Add gs.log and check which line is failing.

Also for testing after query() , add gs.log("row count:::::", grService.getRowCount());

 

Also if it returns multiple records, you can see only 1 record as instead of While you have used if.

 if (grService.next()) {