diff --git a/docs/Clone Children.md b/docs/Clone Children.md index 7c7391b..8844441 100644 --- a/docs/Clone Children.md +++ b/docs/Clone Children.md @@ -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) diff --git a/msdyncrmWorkflowTools/msdyncrmWorkflowTools/Class/CloneChildren.cs b/msdyncrmWorkflowTools/msdyncrmWorkflowTools/Class/CloneChildren.cs index d0b8432..293cd08 100644 --- a/msdyncrmWorkflowTools/msdyncrmWorkflowTools/Class/CloneChildren.cs +++ b/msdyncrmWorkflowTools/msdyncrmWorkflowTools/Class/CloneChildren.cs @@ -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; @@ -41,14 +40,15 @@ public class CloneChildren : CodeActivity [ReferenceTarget("")] public InArgument RelationshipName { get; set; } - [Input("Old Parent Field Name")] - [ReferenceTarget("")] - public InArgument OldParentFieldNameToUpdate { get; set; } - + [RequiredArgument] [Input("New Parent Field Name")] [ReferenceTarget("")] public InArgument NewParentFieldNameToUpdate { get; set; } + [Input("Old Parent Field Name")] + [ReferenceTarget("")] + public InArgument OldParentFieldNameToUpdate { get; set; } + [Input("Prefix")] [Default("")] public InArgument Prefix { get; set; } @@ -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=", ""); @@ -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; diff --git a/msdyncrmWorkflowTools/msdyncrmWorkflowTools/msdyncrmWorkflowTools.csproj.user b/msdyncrmWorkflowTools/msdyncrmWorkflowTools/msdyncrmWorkflowTools.csproj.user index 944ec00..6cbe588 100644 --- a/msdyncrmWorkflowTools/msdyncrmWorkflowTools/msdyncrmWorkflowTools.csproj.user +++ b/msdyncrmWorkflowTools/msdyncrmWorkflowTools/msdyncrmWorkflowTools.csproj.user @@ -1,6 +1,6 @@  - ShowAllFiles + ProjectFiles \ No newline at end of file