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.

Transform Map issue

Debasis Pati
Tera Guru

Hello All,
I have created a transform map for group table created the name field as coelesce and also transformed it it successfully created records everything is fine leaving one thing.
there is a type field which is a list collector in sys_user_group table when i transformed the excel sheet it created some duplicate values in "sys_user_group_type" as incident,change,request etc we already have incident,change,request wtc out of box values how this duplicate value creation can be avoided also it should map the existing correct group types.
one row example of my excel sheet.

Name   Type   Line Vendor/managerDescription    Group email
Testincident,changeDebasistest descriptiontest@group.com

@Ankur Bawiskar  any suggestions?


@

25 REPLIES 25

Hello @Ankur Bawiskar ,

DebasisPati_0-1761125070702.png

 

@Debasis Pati 

try applying filter IS ONE OF and see what it shows

like this

AnkurBawiskar_0-1761125452627.png

 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar ,
Also i encountered one weird issue in servicenow.
like if i use one of and provide the names i end up with 0 records.

DebasisPati_1-1761125474784.png

 

@Debasis Pati 

there is space before each of the text and hence it might be giving 0 results in list and in script as well

I believe there is space coming from excel as well

try removing/trim the space and then see

 

AnkurBawiskar_0-1761125870908.png

updated script

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    // your existing logic


    // handle list logic here
    var typeSysIdArray = [];
    var incomingType = source.u_type.toString();

    var arr = incomingType.split(',');
    for (var i in arr) {
        var gr = new GlideRecord("sys_user_group_type");
        gr.addQuery("name", arr[i].trim());
        gr.query();
        if (gr.next()) {
            typeSysIdArray.push(gr.getUniqueValue());
        }
    }
    gs.info("Type array is" + typeSysIdArray.toString());

    target.type = typeSysIdArray.toString();

})(source, map, log, target);

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar ,

i tried using the above by trimming it to avoid any spaces same result the array is coming as blank values i kept a log and saw.
also if i go to the table and put is one of we are getting 0 records there are no spaces also.
please see the screenshot

DebasisPati_0-1761126506720.png