Community
Showing results for 
Search instead for 
Do you mean 
Reply

Act Api Custom Calculated Fields

New Member
Posts: 6
Country: United_Kingdom

Act Api Custom Calculated Fields

I am ccalling the Act Api and looking at contacts ... my solution does the following

 

1) Get the token from the api

2) Call the Contact get padding in a filter  $filter=(emailAddress eq 'test@test.com')

3) If I find a Contact I then deserialize the response into my objects

4) I then call Contact Put Api for a specified ID i.e. api/contacts/123dsfg-234xdgbsd etc without changing any details (just to see if it works)

 

When I do this I get about 30 error messages like ...

 

 "message":"The request is invalid.",
   "modelState":{
      "cusT_IntialRentalIncludingVAT_083917502":[
         "Invalid Custom Field: does not accept null values."
      ],
      "cusT_TotalUnitCost_093138663":[
         "Invalid Custom Field: does not accept null values."
      ],

 

These are all custom fields.  Some are calculated custom fields (but not all)

 

I am passing data into them from what the api gave me (see below excerpt of Json)

 

"customFields":{
      "cusT_IntialRentalIncludingVAT_083917502":"1",
      "cusT_TotalUnitCost_093138663":"1"

}

 

Any ideas why I am getting this?  There is data?  And it all looks fine as all I am doing is deserialzing into my objects and then serializing back to the api.

 

 

Employee
Posts: 236
Country: USA

Re: Act Api Custom Calculated Fields

Hi,

 

Which version of Web API are you using?  I believe there was an issue with calculated fields in a previous version, but should be resolved in the latest (x144)

New Member
Posts: 6
Country: United_Kingdom

Re: Act Api Custom Calculated Fields

We are using API Version: 1.0.138.0

Employee
Posts: 236
Country: USA

Re: Act Api Custom Calculated Fields

Do upgrade to the latest, .144 and greater should have this fixed.

New Member
Posts: 6
Country: United_Kingdom

Re: Act Api Custom Calculated Fields

Hi Xavier,

 

We have updated and that has cleared all but one error.

 

{
  "message": "The request is invalid.",
  "modelState": {
    "trim": [
      "Invalid Custom Field: does not accept the value '' : the cust_contactstable2_085104 cust_trim_061420858 field does not allow empy values."
    ]
  }
}

 

However ... I have a value here see below ...

 

 

{
  "customFields": {
    "cust_contactstable2_085104 cust_trim_061420858": "abc"
  },

 

We cant even find this field in our custom fields? 

New Member
Posts: 6
Country: United_Kingdom

Re: Act Api Custom Calculated Fields

Hi, we tried this on a blank database with no custom fields and the data updated.

 

Does this sound like an issue with our specific database and field?  The problem is we cant seem to find that field?

Employee
Posts: 38
Country: USA

Re: Act Api Custom Calculated Fields

I have not been able to duplicate this issue locally yet.  Its seem that the field is not serializing and null is passed instead of "ABC", which would though this error.  Are you able to duplicating this issue in Postman or Fiddler as well?

 

  Can I get some information how that field is configured in your database.  Can you send me the metadata for that field. 

 

Environment: API .138

This is how I configured the field to try to duplicate the issue. Endpoint:   /api/metadata/fields?recordType=Contact

{
    "id": "296062d2-11bf-42f3-be65-b0c596bb49b9",
    "name": "customFields/cust_contactstable2_085104 cust_trim_061420858",
    "recordType": "Contact",
    "aliasName": "cust_contactstable2_085104 cust_trim_061420858",
    "displayName": "cust_contactstable2_085104 cust_trim_061420858",
    "type": "Character",
    "length": 50,
    "defaultValue": null,
    "fieldFormat": "",
    "isAllowBlank": false,
    "isCustom": true,
    "isNullable": true,
    "isPrimary": false,
    "isReadOnly": false,
    "isTracked": false,
    "createDate": "2017-04-06T08:53:31-07:00",
    "editDate": "2017-04-06T16:10:28-07:00",
    "picklist": null
  }

 

 

 

New Member
Posts: 6
Country: United_Kingdom

Re: Act Api Custom Calculated Fields

Hi there,

 

Yes postman creates the same issue.  

 

For now we have made the custom field accept blanks... feels like a bit of a hack but the only way we could get it working.

 

Tom

Employee
Posts: 38
Country: USA

Re: Act Api Custom Calculated Fields

So by setting the "AllowBlanks = true", allows you to save a contact with the field set to "abc" or does it just allow you to save a contact, but the field is still null.  If the "AllowBlanks = false", I would expect the error if you passed null, but not "abc".  Thanks for the info, I will continue to try to re-produce and fix this issue.

  

{
  "customFields": {
    "cust_contactstable2_085104 cust_trim_061420858": "abc"
  },

 

 

 

New Member
Posts: 6
Country: United_Kingdom

Re: Act Api Custom Calculated Fields

I will get the details of the field for you next time I am on.

 

You are correct ... it just sets a null into it, its doesnt save ABC