Skip to content

Commit ecd4468

Browse files
authored
Fixes #218 & SetState & SetStateDynamicEntity message property of EntityMoniker (#220) (#222)
* Fixes #218 * SetState & SetStateDynamicEntity use message property of EntityMoniker
1 parent eac47ef commit ecd4468

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

.vs/slnx.sqlite

-12.8 MB
Binary file not shown.

spkl/SparkleXrm.Tasks/CustomAttributeDataEx.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ public static string GetAttributeCode(this CrmPluginRegistrationAttribute attrib
147147
additionalParmeters += indentation + ",DeleteAsyncOperaton = " + attribute.DeleteAsyncOperaton;
148148

149149
if (attribute.UnSecureConfiguration != null)
150-
additionalParmeters += indentation + ",UnSecureConfiguration = \"" + attribute.UnSecureConfiguration + "\"";
150+
additionalParmeters += indentation + ",UnSecureConfiguration = @\"" + attribute.UnSecureConfiguration.Replace("\"","\"\"") + "\"";
151151

152152
if (attribute.SecureConfiguration != null)
153-
additionalParmeters += indentation + ",SecureConfiguration = \"" + attribute.SecureConfiguration + "\"";
153+
additionalParmeters += indentation + ",SecureConfiguration = @\"" + attribute.SecureConfiguration.Replace("\"","\"\"") + "\"";
154154

155155
if (attribute.Action != null)
156156
additionalParmeters += indentation + ",Action = PluginStepOperationEnum." + attribute.Action.ToString();

spkl/SparkleXrm.Tasks/PluginRegistraton.cs

+22-11
Original file line numberDiff line numberDiff line change
@@ -456,23 +456,34 @@ private SdkMessageProcessingStepImage RegisterImage(CrmPluginRegistrationAttribu
456456
{
457457
return null;
458458
}
459-
var image = existingImages.Where(a =>
460-
a.SdkMessageProcessingStepId.Id == step.Id
461-
&&
462-
a.EntityAlias == imageName
463-
&& a.ImageType == (sdkmessageprocessingstepimage_imagetype)imagetype).FirstOrDefault();
464-
if (image == null)
465-
{
466-
image = new SdkMessageProcessingStepImage();
467-
}
459+
460+
var image = existingImages.FirstOrDefault(
461+
a => a.SdkMessageProcessingStepId.Id == step.Id
462+
&& a.EntityAlias == imageName
463+
&& a.ImageType == (sdkmessageprocessingstepimage_imagetype)imagetype) ??
464+
new SdkMessageProcessingStepImage();
468465

469466
image.Name = imageName;
470-
467+
471468
image.ImageType = (sdkmessageprocessingstepimage_imagetype)imagetype;
472469
image.SdkMessageProcessingStepId = new EntityReference(SdkMessageProcessingStep.EntityLogicalName, step.Id);
473470
image.Attributes1 = attributes;
474471
image.EntityAlias = imageName;
475-
image.MessagePropertyName = stepAttribute.Message == "Create" ? "Id" : "Target";
472+
473+
switch (stepAttribute.Message)
474+
{
475+
case "Create":
476+
image.MessagePropertyName = "Id";
477+
break;
478+
case "SetState":
479+
case "SetStateDynamicEntity":
480+
image.MessagePropertyName = "EntityMoniker";
481+
break;
482+
default:
483+
image.MessagePropertyName = "Target";
484+
break;
485+
}
486+
476487
if (image.Id == Guid.Empty)
477488
{
478489
_trace.WriteLine("Registering Image '{0}'", image.Name);

0 commit comments

Comments
 (0)