IRE not being executed while using importSet using onBefore transform script

gaurav72
Tera Contributor

Hi All,

I am using onBefore transform script to implement IRE using below code to identify and ignore duplicate CI.

(function runTransformScript(source, map, log, target ) {
	log.info("Status Log ImpSet");
	var cmdbUtilIRE = new global.CMDBTransformUtil();
	cmdbUtilIRE.setDataSource('ImportSet');
    cmdbUtilIRE.identifyAndReconcileEnhanced(source, map, log);
    ignore = true;

    if (cmdbUtilIRE.hasError()) {
        var errorMessage = cmdbUtilIRE.getError();
		log.info('Error: ' + errorMessage);
        log.error(errorMessage);
    } else {
        log.info('IE Output Payload: ' + cmdbUtilIRE.getOutputPayload());
        log.info('Imported CI: ' + cmdbUtilIRE.getOutputRecordSysId());
    }

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

When I run the transform I do not see any logs from CMDBTransformUtil , below is the import set logs 

find_real_file.png

What would be the possible cause can someone please put some light into this to resolve it.? 

1 ACCEPTED SOLUTION

Only thing I can think of now is to check that someone hasn't changed the accessible from for the Script include in your instance, it should be 'all application scopes':-

find_real_file.png

Happy to have helped even a small bit, please mark my post as useful if it has genuinely helped you.

Thanks,

Richard

View solution in original post

8 REPLIES 8

CMDB Whisperer
Mega Sage
Mega Sage

I don't know if I can guess at the cause of this without further information, but on a related note have you investigated IntegrationHub ETL for importing your CIs?  It takes a bit to get acquainted with but it is a much more flexible and reliable method of importing your CI source data using IRE.  It is the preferred method for all CMDB imports, and I no longer even bother creating standard transform maps for CMDB data source imports.  I would strongly recommend looking into this, because ultimately it will save you time and headaches.


The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

Thanks Paul I will surely give it a try !

Richard Hine
Tera Guru
Tera Guru

I expect some kind of exception might be occuring to cause the code to exit. Suggest you wrap the whole thing in a try - catch block and see if you get more detail?

(function runTransformScript(source, map, log, target ) {

	try{
		log.info("Status Log ImpSet");
		var cmdbUtilIRE = new global.CMDBTransformUtil();
		cmdbUtilIRE.setDataSource('ImportSet');
		cmdbUtilIRE.identifyAndReconcileEnhanced(source, map, log);
		ignore = true;

		if (cmdbUtilIRE.hasError()) {
			var errorMessage = cmdbUtilIRE.getError();
			log.info('Error: ' + errorMessage);
			log.error(errorMessage);
		} else {
			log.info('IE Output Payload: ' + cmdbUtilIRE.getOutputPayload());
			log.info('Imported CI: ' + cmdbUtilIRE.getOutputRecordSysId());
		}
	} catch (err){
		log.error("Caught Error\n" + err);
	}

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

Hope this helps,

Richard

Thanks much Richard!

I see an "Catch Error :TypeError: undefined is not a function." after apply try n catch.

Creating CMDBTransformUtil itself is giving the error.

Is this the correct way to call ?