Transform Map: To reject the record with error message

Mohammed Hyder2
Kilo Expert

Hi All,

I have created a field on the transform map and marked coalesce and made it to reject if that value is not present in the target table, can I have a specific message saying that 'The data is not present in the target table so the row got rejected '

 

5 REPLIES 5

MrMuhammad
Giga Sage

Hi Hyder,

You can write onAfter() script as Pratiksha suggested and do something similar to below sample code to log error. 

 var userName = source.u_user_id;

 var gr = new GlideRecord("sys_user");
 gr.addQuery("user_name", userName);
 gr.setLimit(1);
 gr.query();

 if (gr.next()) {
    return gr.user_name;
 } 
 else{
    log.error('There is no user available with USER ID ' + source.u_user_id);
 }

 

Please mark this helpful if it helps.

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad