Getting org.mozilla.javascript.IdFunctionObject

Hi,

I have a job which when the data is run through a mapper via the workflow it’s returning the below in one of the data fields for every single record:

org.mozilla.javascript.IdFunctionObjectES6@25c46dea

This field is a variable which has a script in to check if it’s valid. However when I just open the mapper the field is either empty of has some text in which gets assigned when there is an error. Any ideas what could be causing this?

Looks like the call in then script isn’t supported and you’re getting the result of the error returned as the value because that’s the last thing to be output from that field.

Can you share the script?

It’s a long script, however if it was the script would I not get the same text when running through mapper directly?

//add something in to extract doc type from 1st page
var DocType = data.extract(78.57066,132.75732,110.91334,4.9106674,“
”);

if (DocType == “PERIODIC STATEMENT”)
{
var AgreementNumPage1 = data.extract(106.341324,132.58798,121.24267,3.0479965,“
”).trim();
var Error = “”;

logger.info("AgreementNumPage1" + AgreementNumPage1);

//if more than a 1 page document then check inv number from subs pages matches the 1st page 
if (steps.totalPages > 1)
	{
		

	for (var Pages = 1;Pages<=steps.totalPages-1;Pages++)
		{
		//move down to next page to extract field
		yPos = 33.714+((Pages-1)*297);
		//get inv number from next page 
		var Text = data.extract(18.796,35.559998,yPos,3.0480042,"<br />").trim();
		var ReturnValue = "";
		var InvNum;
		AgreementNum = Text

		//logger.info("AgreementNum" + AgreementNum);
		if (Text.indexOf("<br />")>0)
			{
			var TextSplitbr = Text.split("<br />");
			
			//go through each line and see if it contains "Invoice Number"
			for (var i=0;i<TextSplitbr.length;i++)
				{
				var Line = TextSplitbr[i];
				if (Line.indexOf("Invoice number:")== 0) 
					{
					//if it does then extract the invoice number 
					var LineSplit = Line.split(":");
					AgreementNum = LineSplit[1].trim();
					}
				}
				
			//check if match found, if not then set as error
		if (AgreementNum != AgreementNumPage1){
		//logger.info(AgreementNum);
		//logger.info(AgreementNumPage1);
		 Error = "Mismatch between pages in pack on invoice number - " + record.fields.Address_Add1;
			}
		
		}
		//if (AgreementNum == "") Error = "Empty Inv Number for -" + record.fields.Address_Add1;
	}


}
else{

var InvNumPage1 = data.extract(67.056,117.348,101.6,8.974663,“
”).trim();
var Error = “”;

// if not period statement then use the below
//if more than a 1 page document then check inv number from subs pages matches the 1st page
if (steps.totalPages > 1)
{

for (var Pages = 1;Pages<=steps.totalPages-1;Pages++)
	{
	if (Pages != 1)
		{
	//move down to next page to extract field
	yPos = 33+((Pages-1)*297);
	//get inv number from next page 
	var Text = data.extract(10,135,yPos,42,"<br />");;
	var ReturnValue = "";
	var InvNum;
	logger.info("yPos " + yPos);
	logger.info("Text " + Text);

	if (Text.indexOf("<br />")>0)
		{
		var TextSplitbr = Text.split("<br />");
		
		//go through each line and see if it contains "Invoice Number"
		for (var i=0;i<TextSplitbr.length;i++)
			{
			var Line = TextSplitbr[i];
			if (Line.indexOf("Invoice number:")== 0) 
				{
				//if it does then extract the invoice number 
				var LineSplit = Line.split(":");
				InvNum = LineSplit[1].trim();
				}
			}
			
		//check if match found, if not then set as error
		if (InvNum != InvNumPage1) Error = "Mismatch between pages in pack on invoice number - " + record.fields.Address_Add1;
		logger.info("InvNumPage1 " + InvNumPage1);
		logger.info("InvNum " + InvNum);
		}
	}
	if (InvNum == "") Error = "Empty Inv Number for -" + record.fields.Address_Add1;
	}
}

}

//return error value
Error;

It’s ok figured it out. Turns out the mapper I was looking at and the one that had been sent to the workflow weren’t the same! It was an issue in the script which I’ve now fixed