Do we have a way to copy a record and all associated child records?
*This post is locked for comments
Hi Silbert,
we have a product Record Clone which allows 1-Click Cloning of any record
in CRM.
Below are some of the features :
Ability to clone System entities as well as Custom and their related child entities
Once cloned or copied, the newly created record pops up on the User Interface
Ability to Clone multiple records too (making X Clones of a single record in a click)
Can also Clone records from Workflows
You can try our product by following the below link.
www.work365apps.com/record-clone
Hope this helps.
Only by custom workflow/plugin/javascript or by installing some 3rd party tools (which use the same under the hood)
We have a solution Click2Clone with below features.
You can try our product by following the below link.
http://www.inogic.com/product/productivity-pack/click-2-clone-microsoft-dynamics-crm-records
Hope this helps.
Thanks!
You can do a plugin that retrieves the record, and within each record, retrieve all Entity Collections for the subgrids/child entities:
// Main Code Base
Entity parent = RetrieveParent(parentId);
if (parent != null)
{
Guid newParentId = CreateParent(parent);
EntityCollection children1 = RetrieveChildren(parent.Id);
if (children1.Entities.Count > 0)
{
foreach (Entity child in children1.Entities)
{
Guid newChild1Id = CreateChild(child, newParentId);
}
}
}
private Guid CreateParent(Entity parent)
{
Entity newParent = new Entity(bgx_Parent.EntityLogicalName);
foreach (KeyValuePair<String, Object> attribute in project.Attributes)
{
string attributeName = attribute.Key;
object attributeValue = attribute.Value;
switch (attributeName.ToLower())
{
case "bgx_parentid":
break;
default:
newParent[attributeName] = attributeValue;
break;
}
}
try
{
Guid parentId = service.Create(newParent);
return parentId;
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException("An error occurred in the CreateParent function of the plug-in.", ex);
}
}
private Guid CreateChild(Entity child, Guid parentId)
{
Entity newChild = new Entity("bgx_Child1");
foreach (KeyValuePair<String, Object> attribute in child.Attributes)
{
string attributeName = attribute.Key;
object attributeValue = attribute.Value;
switch (attributeName.ToLower())
{
case "bgx_parentid":
newChild[attributeName] = new EntityReference("bgx_parent", parentId);
break;
case "bgx_childid":
break;
default:
newChild[attributeName] = attributeValue;
break;
}
}
try
{
Guid childId = service.Create(newChild);
return childId;
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException("An error occurred in the CreateChildfunction of the plug-in.", ex);
}
}
You can probably create a generic class for the Create Child that will apply to all child entities.
Good luck
Hi,
I've used the following custom workflow activity to do something similar in the past:
crm2011distributewf.codeplex.com
Regards
Bharat
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,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156