Tuesday, 12 March 2013

AIF - Object reference not set to an instance of an object

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode>s:Client</faultcode>
         <faultstring xml:lang="en-GB">Object reference not set to an instance of an object.</faultstring>
      </s:Fault>
   </s:Body>
</s:Envelope>


There could be many reason for this error message, but this post is just to share the reason we hit this error.

Below are the details:
  • We have a document service for a query (a main datasource with 3 sub datasource)
  • At one of the sub datasource, among the field list, one of the field is causing the error shown above
  • If this field is removed from the query, it works fine
  • Further investigation found that this field has a property of Mandatory = Yes, EDT of RefRecId
  • In the respective table, there's a relation for this field linking to another table's RecId
    Eg: SubTable.FieldA == RelatedTable.RecId
  • RelatedTable is an inherited table
  • At the parent table for RelatedTable, is has a replacement key
This error only happen if this mandatory field is == 0.

We tried testing it against normal mandatory field (Eg. a text field), even if empty (not filled in), the error didn't occur, it only occur to field that's linked to another table (and when the above conditions are true)

No comments:

Post a Comment