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

SDK.REST.createRecord Error : 400: Bad Request: Error processing request stream.

$
0
0

I am using CRM 2011, and I am trying to use the SDK.REST.createRecord function. It works great for all of my fields on the entity except 4 specific ones.  1 Lookup, 2 OptionSets, and 1 Boolean.  All other fields of those types (and others) work perfectly, but these 4 keep causing me problems.  I get the below error for each (with the field name being different based on the on the field I am trying to fix.)



Error : 400: Bad Request: Error processing request stream. The property name 'field_Name' specified for type 'Microsoft.Crn.Sdk.Data.Services.field_Name' is not valid.

For each of the different field types I have code specific for each.

             if (fieldType == "lookup")
            {
                var lookUpObjectValue = attribute.getValue();

                if (lookUpObjectValue != null)
                {
                    var lookuptextvalue = lookUpObjectValue[0].name;
                    var lookupid = lookUpObjectValue[0].id;
                    var lookupentitytype = lookUpObjectValue[0].entityType;

                    geClone[aName] = { Id: lookupid, LogicalName: lookupentitytype, Name: lookuptextvalue };
                }
            }

            else if (fieldType == "optionset")
            {
                var optionsetValue = attribute.getValue();
                if (optionsetValue != null) {
                    geClone[aName] = { Value: optionsetValue };
                }
            }

    if (fieldType == "boolean")
            {
                var boolean = attribute.getValue();
                if (boolean) {
                    geClone[aName] = true;
                }
else {
                    geClone[aName] = false;
}
            }

This code works for the other matching field types on the Entity, but not these 4.


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>