Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Demian Adolfo Raschkovan committed Oct 27, 2019
2 parents c54c12c + 827b919 commit 7514493
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/Clone Children.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ The full params description is:
* **Source Record URL (required)** : the URL of the parent record that contains the child records you want to clone.
* **Target Record URL (required)** : the URL of the parent record that will the cloned child.
* **Relationship Name (required)** : the schema name for the relationship to use to find the child records.
* **Old Parent Field Name (required)** : the schema name for the Lookup field on the child records for the original parent.
* **New Parent Field Name (optional)** : the schema name for the Lookup field on the child records for the new parent. This optional parameter is used in case the cloned children should be linked to the new parent using a different lookup field. If not specified it will use the same as the Old Parent lookup.
* **New Parent Field Name (required)** : the schema name for the Lookup field on the child records for the new parent.
* **Old Parent Field Name (optional)** : the schema name for the Lookup field on the child records for the original parent. This optional parameter is used in case the cloned children should be linked to the new parent using a different lookup field. If not specified it will use the same as the New Parent lookup.
* **Prefix (optional)** : the prefix will be addedd at the name attribute of the clonned record.
* **Fields to Ignore (optional)** : the list of attributes you want to ignore in cloning, separate by ";" (in lowercase)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Workflow;
Expand Down Expand Up @@ -41,14 +40,15 @@ public class CloneChildren : CodeActivity
[ReferenceTarget("")]
public InArgument<String> RelationshipName { get; set; }

[Input("Old Parent Field Name")]
[ReferenceTarget("")]
public InArgument<String> OldParentFieldNameToUpdate { get; set; }

[RequiredArgument]
[Input("New Parent Field Name")]
[ReferenceTarget("")]
public InArgument<String> NewParentFieldNameToUpdate { get; set; }

[Input("Old Parent Field Name")]
[ReferenceTarget("")]
public InArgument<String> OldParentFieldNameToUpdate { get; set; }

[Input("Prefix")]
[Default("")]
public InArgument<String> Prefix { get; set; }
Expand Down Expand Up @@ -83,13 +83,12 @@ protected override void Execute(CodeActivityContext executionContext)
return;
}



String _source = this.SourceRecordUrl.Get(executionContext);
if (_source == null || _source == "")
{
return;
}

string[] urlParts = _source.Split("?".ToArray());
string[] urlParams = urlParts[1].Split("&".ToCharArray());
string parentObjectTypeCode = urlParams[0].Replace("etc=", "");
Expand Down Expand Up @@ -123,7 +122,7 @@ protected override void Execute(CodeActivityContext executionContext)

foreach (var item in children.Entities)
{
var newRecordId = objCommon.CloneRecord(item.LogicalName, item.Id.ToString(),fieldstoIgnore, prefix );
var newRecordId = objCommon.CloneRecord(item.LogicalName, item.Id.ToString(), fieldstoIgnore, prefix);

Entity update = new Entity(item.LogicalName);
update.Id = newRecordId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

0 comments on commit 7514493

Please sign in to comment.