Shadow Breeze
asked on
JavaScript - adding rows to array from SOAP call fails - TypeError: Cannot set property "0.0" of undefined to ""
Background: This is an excerpt from the Post_Execution Code segment from a CA Technologies Process Automation custom operator. "Get CI Details Process"
The upstream inputs to this SOAP call are correct and this code works:
However, when I add 3 new inputs to the call and then try to capture them in the response:
I get the error in the subject line.
I have verified the new input parameters and responses are correct both via SoapUI and by examining the response prior the execution of the code.
Based on my search on the error, the new variables are never being defined. The "0.0" made me think it was a type error however, the responses from myAttributes[1]-[4] are exactly the same type. These are UUID's as strings, even if they can begin with number. The values are not NULL nor empty strings.
The upstream inputs to this SOAP call are correct and this code works:
Process.CI_Length__ = Process[OpName].SelectDataResponse.UDSObject.length;
for ( j = 0; j < Process[OpName].SelectDataResponse.UDSObject.length; j++ )
{
str = "row" + j;
Process[OpName].Rows[str] = newValueMap();
var myAttributes = new Array();
myAttributes = Local[IconName].SelectDataResponse.UDSObject[j].Attributes[0].Attribute;
Process.CI_Name__[j] = myAttributes[0].AttrValue[0].text_;
Process.CI_Support_Cont1_Name__[j] = myAttributes[1].AttrValue[0].text_;
Process.CI_Support_Cont2_Name__[j] = myAttributes[2].AttrValue[0].text_;
Process.CI_Support_Cont3_Name__[j] = myAttributes[3].AttrValue[0].text_;
Process.CI_Network_Cont_Name__[j] = myAttributes[4].AttrValue[0].text_;
Process.CI_UUID__[j] = myAttributes[5].AttrValue[0].text_;
Process.OperatorResultCode__ = "SUCCESS";
}
However, when I add 3 new inputs to the call and then try to capture them in the response:
Process.CI_Length__ = Process[OpName].SelectDataResponse.UDSObject.length;
for ( j = 0; j < Process[OpName].SelectDataResponse.UDSObject.length; j++ )
{
str = "row" + j;
Process[OpName].Rows[str] = newValueMap();
var myAttributes = new Array();
myAttributes = Local[IconName].SelectDataResponse.UDSObject[j].Attributes[0].Attribute;
Process.CI_Name__[j] = myAttributes[0].AttrValue[0].text_;
Process.CI_Support_Cont1_Name__[j] = myAttributes[1].AttrValue[0].text_;
Process.CI_Support_Cont2_Name__[j] = myAttributes[2].AttrValue[0].text_;
Process.CI_Support_Cont3_Name__[j] = myAttributes[3].AttrValue[0].text_;
Process.CI_Network_Cont_Name__[j] = myAttributes[4].AttrValue[0].text_;
Process.CI_UUID__[j] = myAttributes[5].AttrValue[0].text_;
Process.CI_Med_Risk_App_Group__[j] = myAttributes[6].AttrValue[0].text_;
Process.CI_High_Risk_App_Group__[j] = myAttributes[7].AttrValue[0].text_;
Process.CI_QA_App_Group__[j] = myAttributes[8].AttrValue[0].text_;
Process.OperatorResultCode__ = "SUCCESS";
}
I get the error in the subject line.
I have verified the new input parameters and responses are correct both via SoapUI and by examining the response prior the execution of the code.
Based on my search on the error, the new variables are never being defined. The "0.0" made me think it was a type error however, the responses from myAttributes[1]-[4] are exactly the same type. These are UUID's as strings, even if they can begin with number. The values are not NULL nor empty strings.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This does resolve the issue. (I had continued working on it before your post and introduced a typo later in the code block - so that was why it wasn't capturing the response).
ASKER
I can't find anywhere upstream of this where the previous elements were explicitly declared. (I'm not saying they aren't - just that I haven't found them).