Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

please check below script why vcac value is not taking correct one

mani55
Tera Contributor

please check below script why vcac value is not taking correct one

 //check OS
    var vcac;
    var query_ticket = 'cat_item=' + api_catalog.catalog_item.sys_id;

    var grTicket = new GlideRecord('sc_req_item');
    grTicket.addEncodedQuery(query_ticket);
    grTicket.setLimit(1);
    grTicket.query();
    while (grTicket.next()) {

        if (grTicket.cat_item.u_launch_method == "Manual") {
            var gr = new GlideRecord('u_cmdb_ci_vmware_os');
            gr.addEncodedQuery('u_active=true^name!=Red Hat EL 6.x English - 64 bit^u_vm_type=' + request_body.vm_type + '^u_datacenter=' + request_body.datacenter + 'u_vcac_flag=false');
            gr.query();
            while (gr.next()) {
                vcac = gr.name;
				gs.log('the value'+vcac);
            }
        } else {
            var gm = new GlideRecord('u_cmdb_ci_vmware_os');
            gm.addEncodedQuery('u_active=true^name!=Red Hat EL 6.x English - 64 bit^u_vm_type=' + request_body.vm_type + '^u_datacenter=' + request_body.datacenter + 'u_vcac_flag=true');
            gm.query();
            while (gm.next()) {
                vcac = gm.name;
					gs.log('the answer'+vcac);
            }
        }
    }

please let me know   anything worng in my script because filter is not working 

5 REPLIES 5

So is this the full script or only a small part? For example if quickly look at "request_body", that's nowhere defined or whatever. So you are not sharing everything I guess?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn