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
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
Yes, for child records you need to set entity reference like below
customEntity[“referencefieldname”]=new EntityReference(“opportunity”,entity.id);
my custom entity is child entity of opportunity , so do I have to define relationship also in plugin?
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.
Hi Shristi ,
You can also try with ExecuteMultiple -
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.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
52
Victor Onyebuchi
6