TypeError : undefined is not a function when using IRE CMDBTransformUtil();

gaurav72
Tera Contributor

I am importing CI using ImportSet and using an onBefore transform script to call IRE

try{
var cmdbUtilIRE = new global.CMDBTransformUtil();
}
catch(err){
log.info("Error :"+err);
{

After executing  "TypeError : undefined is not a function" as error.

What would be the correct way to resolve this issue. Thanks in advance.

1 ACCEPTED SOLUTION
5 REPLIES 5

Sai Kumar B
Mega Sage
Mega Sage

@gaurav72 

Try the below code

// add this code to the onBefore transform map script
// Call CMDB API to do Identification and Reconciliation of current row
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('ImportSet');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;

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

Sai,

Probably doesn't mention in the original post but it is in a scoped app...

Richard

Yeah might be

@gaurav72 If you're trying in scoped app replace the first line with 

var cmdbUtil = new global.CMDBTransformUtil();

If you look in the original post that is what he is trying to do.

I had suggested in another thread that he check if someone has changed the Accessible from on the script include.