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

  • Question

  • 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.

    Saturday, November 30, 2013 4:37 AM

Answers

  • Hi,

    Your code looks good, please re-check you are passing correct field's schema name (this is case sensitive).

    like : afl_stateopid it could be afl_StateopId or something like that.


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog


    • Edited by _Vikram Saturday, November 30, 2013 5:16 AM
    • Marked as answer by JustSmitty Saturday, November 30, 2013 10:53 PM
    Saturday, November 30, 2013 5:15 AM

All replies

  • Hi,

    Your code looks good, please re-check you are passing correct field's schema name (this is case sensitive).

    like : afl_stateopid it could be afl_StateopId or something like that.


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog


    • Edited by _Vikram Saturday, November 30, 2013 5:16 AM
    • Marked as answer by JustSmitty Saturday, November 30, 2013 10:53 PM
    Saturday, November 30, 2013 5:15 AM
  • You were spot on!!!  Thank you so much!!!  The field names were slightly different from the schema names on those 4 fields.

    Saturday, November 30, 2013 10:53 PM