Transform Map GlideRecord Script

EB7
Giga Contributor

Hello,

I am trying to query the a manufacturer table with this script during transform so that it will load the company column in the users table with their manufacturer name based on the conditions in the script. The problem is that the second condition [a1.addQuery("u_flag", true);] in the query is getting ignored. Please help.

Here is the Transform map script:

answer = (function transformEntry(source) {

var mfrID = "";

// Get company record using manufacturer key
if(source.company_seq){
var a1 = new GlideRecord("core_company");
a1.addQuery("u_company_seq", source.company_seq);
a1.addQuery("u_flag", true); //this condition is being ignored.
a1.query();
if(a1.next()){
companyID = a1.getUniqueValue();
}
}

return mfrID;

})(source);

 

Thanks!

3 REPLIES 3

Elijah Aromola
Mega Sage

Try the following:

answer = (function transformEntry(source) {

    var mfrID = "";

    // Get company record using manufacturer key
    if (source.company_seq) {
        var a1 = new GlideRecord("core_company");
        a1.addEncodedQuery("u_company_seq=" + source.company_seq + "^u_flag=true")
        a1.query();
        if (a1.next()) {
            companyID = a1.getUniqueValue();
        }
    }

    return mfrID;

})(source);

Trying this now... I'll let you know if it works in a little bit.

Thanks for the quick reply!

I have tried and the second condition is still getting ignored