OnComplete Script, why it is giving undefined

Singhdeep70
Tera Contributor
(function runTransformScript(source, map, log, target ) {

    var runGR = map.sys_id;

    if(runGR){
        var inserted = runGR.inserts;
        var updated = runGR.updates;
        var rejected = runGR.ignored;
        var total = runGR.total;

        var summary = "Inserted: " + inserted +
                      ", Updated: " + updated +
                      ", Rejected: " + rejected +
                      ", Total: " + total;

        gs.eventQueue("Incident.import.complete", null, summary, "");
    }

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

Zach Koch
Giga Sage

You're trying use a string as a GlideRecord. In your script runGR is a string, not a GlideRecord, so anywhere you use runGR and try to access the attribute, you get undefined because it doesn't exist. If you're trying to use map as a GlideRecord, then use map.<yourAttribute>  instead of runGR. <yourAttribute>

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!