Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

creating multiple record of an existing entity

(0) ShareShare
ReportReport
Posted on by

I have an array of records in plugin code  , and I want to create multiple record iterating through the array , how can I write plugin to store multiple records in existing entity.

*This post is locked for comments

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: creating multiple record of an existing entity

    Yes, for child records you need to set entity reference like below

    customEntity[“referencefieldname”]=new EntityReference(“opportunity”,entity.id);

  • Community Member Profile Picture
    on at
    RE: creating multiple record of an existing entity

    my custom entity is child entity of opportunity , so do I have to define relationship also in plugin?

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: creating multiple record of an existing entity

    Keep in mind there is no use of Executemultiple request in plugin, as plugin use executemultiple request internally in case your plugin runs under transactions.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: creating multiple record of an existing entity

    Hi Shristi ,

    You can also try with ExecuteMultiple  -

    msdynamicscrmblog.wordpress.com/.../use-executemultiplerequest-for-bulk-createupdatedelete-using-c-in-dynamics-crm-2011-2

    msdn.microsoft.com/.../jj863631.aspx

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: creating multiple record of an existing entity

    Hi,

    Assuming you have array that you want to use to create custom entity record ? if yes you can loop through the length of the array and can use create method for your entity something like this

    for(int i=0; i<array.Lenght; i++)

    {

    Entity customEntity=new Entity("your entityname");

    customEntity["yourcustomentityfield"]=array[i]; //you need different syntax for different data type

    crmservice.Create(customEntity);

    }

    Please check SDK for more details, let me know if my understanding is not correct.

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 Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans