locked
convert Crm 4.0 plugin code to Crm 2011 help RRS feed

  • Question

  • I am trying to convert the following plugin code to CRM 2011. I appreciate any help.

    //Get Pre Image Attributes
    
              pick = (Picklist)preMessageImage.Attributes["new_picklistaction"];
              templateId = (Lookup)preMessageImage.Attributes["new_templateid"];
    
    
    //Get parentID
    
            RetrieveEntityResponse resp = (RetrieveEntityResponse)metadataService.Execute(rar);
            string keyName = resp.EntityMetadata.PrimaryKey;
    
            if (context.InputParameters[ParameterName.Target] is DynamicEntity)
            {
              Key key = (Key)((Entity)context.InputParameters[ParameterName.Target]).Properties[keyName];
              parentID = key.Value;
            }
    
    
    // add return value to entity
    
                  StringProperty addReturnValue = new StringProperty("new_uid", testGuid);
                  entity.Properties.Add(addReturnValue);
    Monday, May 9, 2011 5:03 PM

Answers

  • Hello -

     

    Here are the updated types:

    Picklist and Lookup are now OptionValue and EntityReferences respectively...

              pick = (OptionValue)preMessageImage.Attributes["new_picklistaction"];

              templateId = (EntityReference)preMessageImage.Attributes["new_templateid"];

    DynamicEntity is now just "Entity"

              if (context.InputParameters[ParameterName.Target] is Entity)

    -Brandon

    • Proposed as answer by BSimons Wednesday, June 1, 2011 11:11 PM
    • Marked as answer by Jim Glass Jr Tuesday, June 7, 2011 8:37 PM
    Monday, May 9, 2011 11:11 PM

All replies

  • Hello -

     

    Here are the updated types:

    Picklist and Lookup are now OptionValue and EntityReferences respectively...

              pick = (OptionValue)preMessageImage.Attributes["new_picklistaction"];

              templateId = (EntityReference)preMessageImage.Attributes["new_templateid"];

    DynamicEntity is now just "Entity"

              if (context.InputParameters[ParameterName.Target] is Entity)

    -Brandon

    • Proposed as answer by BSimons Wednesday, June 1, 2011 11:11 PM
    • Marked as answer by Jim Glass Jr Tuesday, June 7, 2011 8:37 PM
    Monday, May 9, 2011 11:11 PM
  • OptionValue is not defined in my plugin. Where is that defined?

     

    Ben

    Tuesday, May 10, 2011 5:44 PM
  • Use OptionSetValue.

    Tuesday, May 10, 2011 6:48 PM
  • Apologies, yes as anate says, use OptionSetValue.

     

    Tuesday, May 10, 2011 10:50 PM