Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

DataType issues with REST/ODATA Endpoints

$
0
0

Hi All,

I am trying to create a new account record in CRM using ODATA Endpoint, in that I am getting problems with specific data types.

I am able to manage creating record with attribute types string, owner, lookup, optionset, but I am getting problems when I try to create with attributes Money, Number and Boolean.

The following is the piece of code.  Could any one please let me know what is wrong with my code.

CRMObject.Name = "Osm Test Create"; //String Type 
CRMObject.Telephone1 ="9876543210";
CRMObject.Fax = "Test Fax";
CRMObject.Telephone2 = "7894561230";
CRMObject.IndustryCode = { Value: 2 };

//OptionSet Type
CRMObject.PrimaryContactId = { Id: "XXXXXXXXXXXXXXXXXXXXX", LogicalName: "contact" }; //Lookup Type
CRMObject.OwnerId = { Id: "XXXXXXXXXXXXXXXXXXXXXXX", LogicalName: "systemuser" }; //Owner Type


////No problem with the above data types, Please see the following types which are giving errors
CRMObject.NumberOfEmployees = { Value: 10 };//Number
CRMObject.Revenue = { Value: 9000 };//Money
CRMObject.DoNotFax = { Value: true}; //Boolean Type

 
I tried by passing parseFloat value in Revenue attribute as CRMObject.Revenue = { Value: parseFloat(9000)}, but that also not working.

I am getting the following error.  (XMLHttpRequest.responseText value in the failure case)

failure : {

"error": {

"code": "-2147220989", "message": {

"lang": "en-US", "value": "Incorrect attribute value type System.Data.Services.Serializers.JsonReader+JsonObjectRecords"

}

}

}

Please help me in rosolving this issue. Thanks in Advance.

Thanks and Regards

Ramu

http://www.osmosys.asia


Viewing all articles
Browse latest Browse all 8223

Trending Articles