Show error message in the target record using transform map

BALAJI K R
Tera Expert

Hi,

 

The requirement here is that the transform should not happen when the mandatory fields are missing from the excel (which can be achieved by enforce mandatory fields), when these type of records are ignored by the transform we need to show a error message that "The import has missing mandatory fields" in the target record. How can we achieve this?

4 REPLIES 4

Hetang Modi
Tera Contributor

Have you tried using the onBefore Transform scripts? You can refer this page to achieve your use case. For example, if in the `source` object you do not find the required fields present, you can update using the `target` object and abort the action. More information here.

Meloper
Kilo Sage

Hi,

If you want to check this for each individual record or each individual line in the Excel file.
I would write an on Before Transform script and check for these fields with a script before each "Transform line" (field != '')
if the result is false, you could fire an event and write a mail or something else.

If the goal is a one-time check.
After the transform, I would go through the import table (glider record) in an On COmplete Transform script and search for empty fields.
If there is one, you could write another mail.

Hi,

 

Can you please provide the sample script for the OnComplete transform script using gliderecord?

 

Thanks

// Read all records of the current import set again
var grImport = new GlideRecord('your import table');
grImport.addQuery('sys_import_set',import_set.sys_id);
grImport.query();
while(grImport.next()) {

if (grImport.getValue("yourfield") == '')
//do something

}