0

In an attempt to sum up all of the “estimated values” located in a field on contract lines within a contract and place that value on the main contract page, I hit up my friend Google and discovered the crmservice of RetrieveMultiple using JScript as described in this link:

http://msdn.microsoft.com/en-us/library/cc677077.aspx

Using that example, i only seemed to be able to pull values on fields that were native to the system such as ‘net’, ‘title’, ‘rate’, ‘contractid’, etc.

However, when i attempted to get values for fields that i created for the entity and manually added to the form, I was getting a “unable to get value of the property ‘nodeTypedValue’: object is null or undefined” error.

Using the script in the link above, I was finding that if i put a field name in the select area of the SOAP message:
(“<q1:Attribute>title</q1:Attribute>”) that wasn’t a field available in the entity, it would give me the error stating that it wasn’t there (“‘ContractDetail’ entity doesn’t contain attribute with Name = ‘new_estvaluefsdfsd’”)

but when i put in a field named “new_hours” or “new_estvalue”, it WOULDN’T show me that error and instead the “unable to get value of the property ‘nodeTypedValue’: object is null or undefined” error.

I adjusted the “<q1:Criteria>” of the SOAP message and changed essentially the ‘where contractID = [contractID]‘  TO  ‘new_estvalue’ = ’200′ and it was able to pull the value.

The problem resided because it wasn’t able to pull back a null value so by putting the check in the WHERE clause of the SOAP message to not allow any null values, it ensured it wouldn’t get that error above.

“<q1:Condition>”+
“<q1:AttributeName>new_estvalue</q1:AttributeName>”+
“<q1:Operator>NotNull</q1:Operator>”+
“</q1:Condition>”

You can also use this within the loop to exclude any null values from being used:

if(results[i].selectSingleNode(‘./q1:new_hours’)!=null)
{

}

 

Leave a Reply

You must be logged in to post a comment.