Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Create a record with setting some party list fields (regardingobjectid, from , to)

(0) ShareShare
ReportReport
Posted on by 50

Hello,

I am working on a functionality where I am on an entity - Customer Leads. Now, in this entity we have a HTML web resource embedded on the form.  On click of a button in that web resource, it needs to create a new record of the entity Customer appointment. The customer appointment entity has a few party list fields - regardingobjectid, from, to. I am trying to set the values for these party list fields and its not working for me. I researched some of the forums out there but everything is providing a solution only to create in the same entity. Not sure how to do it in a different entity. This is what am doing:

 let regardingobjectidvalues = [];
        regardingobjectidvalues.push({
            id: customerleadId,
            name: "Jane Doe",
            entityType: "ed_customerlead"
        });
        let data = {
            regardingobjectid: regardingobjectidvalues,
            "ownerid@odata.bind": `/systemusers(${currentUserId})`,
            subject: value,
            description: value,

        }

        Xrm.WebApi.createRecord("ed_customerappointment", data).then(
            function success(result) {
                console.log("Success" + result.id);
                // perform operations on record creation
            },
            function (error) {
                console.log(error.message);
                // handle error conditions
            }
        );
Error message:
An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.
at System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty property, IEdmStructuredTypeReference resourceType, Object resource, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)
at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)
at Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)
at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)
at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)
  • Leyan Shrestha Profile Picture
    5 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    Hi Daniel,

    How did you update the from and to?

    Thanks,

    Leyan

  • Suggested answer
    Anks27 Profile Picture
    1,083 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    As I said earlier, issue was with filed name, correct?? looks like once I suggested on regardingobjectid you changed in your code, correct???

    Signed, Sealed and Delivered.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

     

    Thanks & Regards,

    Ankit Shah(MCT-Microsoft Certified Trainer)

     

    Follow/Connect 101 on below

    LinkedIn:-   https://linkedin.com/in/dynamicpower101/

    Twitter:-     https://twitter.com/Dynamicpower101

    Facebook:- https://facebook.com/DynamicPower101/

    Telegram:- https://t.me/dynamicpower101

    Medium:-   https://medium.com/dynamicpower101

  • Verified answer
    DDaniels Profile Picture
    50 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    Thanks for your input Ankit. That is correct. ` operator is a recent change and is recommended to use it instead of "". Anyways, I found the way to assign the value.

            let parties = [];

           parties.push({

             "partyid_ed_customerlead@odata.bind": "ed_customerleads(" + customerLeadid+ ")",

             participationtypemask: 2 // To

           });

           let data = {

                ed_customerlead_activity_parties: parties,

               "ownerid@odata.bind": `/systemusers(${currentUserId})`,

               subject: value,

               description: value,

           }

           Xrm.WebApi.createRecord("ed_customerappointment", data).then(

               function success(result) {

                   console.log("Success: " + result.id);

                   // perform operations on record creation

               },

               function (error) {

                   console.log(error.message);

                   // handle error conditions

               }

           );

  • Suggested answer
    Anks27 Profile Picture
    1,083 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    Hello once again I have checked your code in detail, can you double check your code??

    Check below line.

    "ownerid@odata.bind": `/systemusers(${currentUserId})`,
    please check single line quote in this, try with ' instead of `.

    Let me know which type of single quote in your code?

    Signed, Sealed and Delivered.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

     

    Thanks & Regards,

    Ankit Shah(MCT-Microsoft Certified Trainer)

     

    Follow/Connect 101 on below

    LinkedIn:-   https://linkedin.com/in/dynamicpower101/

    Twitter:-     https://twitter.com/Dynamicpower101

    Facebook:- https://facebook.com/DynamicPower101/

    Telegram:- https://t.me/dynamicpower101

    Medium:-   https://medium.com/dynamicpower101

  • DDaniels Profile Picture
    50 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    Hi Ankit,

    Thanks for responding. Yes, I do have a field called regardingobjectid. It is a party list field.  Should I be assigning the  values in a different manner?

  • Suggested answer
    Anks27 Profile Picture
    1,083 on at
    RE: Create a record with setting some party list fields (regardingobjectid, from , to)

    Hello,

    This error indicates that in your request you have a property/field that you are trying to set, doesn't exist in CRM or not matching with the name.

    Are you sure you have a field ‘regardingobjectid’ on you customer appointment entity?

    Signed, Sealed and Delivered.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

     

    Thanks & Regards,

    Ankit Shah(MCT-Microsoft Certified Trainer)

     

    Follow/Connect 101 on below

    LinkedIn:-   https://linkedin.com/in/dynamicpower101/

    Twitter:-     https://twitter.com/Dynamicpower101

    Facebook:- https://facebook.com/DynamicPower101/

    Telegram:- https://t.me/dynamicpower101

    Medium:-   https://medium.com/dynamicpower101

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,996 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans