@@ -456,23 +456,34 @@ private SdkMessageProcessingStepImage RegisterImage(CrmPluginRegistrationAttribu
456
456
{
457
457
return null ;
458
458
}
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 ( ) ;
468
465
469
466
image . Name = imageName ;
470
-
467
+
471
468
image . ImageType = ( sdkmessageprocessingstepimage_imagetype ) imagetype ;
472
469
image . SdkMessageProcessingStepId = new EntityReference ( SdkMessageProcessingStep . EntityLogicalName , step . Id ) ;
473
470
image . Attributes1 = attributes ;
474
471
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
+
476
487
if ( image . Id == Guid . Empty )
477
488
{
478
489
_trace . WriteLine ( "Registering Image '{0}'" , image . Name ) ;
0 commit comments