Is it possible to bulk create orders with the same customer details?
*This post is locked for comments
Is it possible to bulk create orders with the same customer details?
*This post is locked for comments
What value do you have in salesorderguid?
Also make sure that the Guid is not inside quotes if you are using a variable.
Entity orderFROM = crmService.Retrieve("salesorder", new Guid("12345678-1234-1234-1234-123456789012"), new ColumnSet(true));
or
string salesorderguid = "12345678-1234-1234-1234-123456789012";
Entity orderFROM = crmService.Retrieve("salesorder", new Guid(salesorderguid), new ColumnSet(true));
Hope this helps.
Hello
I embedded your function on my plugin but I am receiving exception at this line:
Entity orderFROM = crmService.Retrieve("salesorder", new Guid("salesorderguid"), new ColumnSet(true));
System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Please advise.
Thanks for anticipation.
Eman Abed AlWahhab
Hi M.trieu19,
if you solved the problem thanks to an answer, please mark it as verified to encourage the community to provide more and more a better support. Thank you. Francesco
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY
Independent Contractor
Hi M.trieu19,
use the following coe:
Entity orderFROM = crmService.Retrieve("salesorder", new Guid("salesorderguid"), new ColumnSet(true)); Entity orderTO = new Entity("salesorder"); foreach (KeyValuePair<string, object> attr in orderFROM.Attributes) { if (attr.Key == "statecode" || attr.Key == "statuscode" || attr.Key == "salesorderid" || attr.Key == "ordernumber") continue; orderTO[attr.Key] = attr.Value; } Guid orderTOguid = crmService.Create(orderTO); QueryByAttribute query = new QueryByAttribute("salesorderdetail"); query.ColumnSet = new ColumnSet(true); query.Attributes.AddRange("salesorderid"); query.Values.AddRange(orderFROM.Id); List<Entity> orderdetailFROMlist = crmService.RetrieveMultiple(query).Entities.ToList(); List<Entity> salesorderdetailTO = new List<Entity>(); foreach (Entity orderdetailFROM in orderdetailFROMlist) { Entity orderdetailTO = new Entity("salesorderdetail"); foreach (KeyValuePair<string, object> attr in orderdetailFROM.Attributes) { if (attr.Key == "salesorderid") continue; orderdetailTO[attr.Key] = attr.Value; } orderdetailTO["salesorderid"] = orderFROM.Id; crmService.Create(orderdetailTO); }
Please let me know.
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
You could probably add a Command Bar button (using Ribbon Workbench) in the Account entity (for customer) called Create Order. On the click of a button you can call an Action, Workflow or WebApi (via JavaScript) that will create a new order with the details of the Account that you specified.
Whatever account you call this from would create the same data for the Order with the exception of the account name.
Alternatively, you can create a web resource that would open on the order form, where the user would select an account, and you would call one of the processes above to create the order.
There are other options, but I think one of these would work for your needs.
Hope this helps.
Hi,
The user wants to create multiple orders which contains the same data input in the fields. The only thing different would be the order number.
I'm not too sure what other information you need...
Thanks,
Hi M.trieu19,
please provide more detail about the flow, your description is poor of details.
Thanks
Francesco
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156