Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Creating Dynamic email CC field with plugin.

Unanswered Creating Dynamic email CC field with plugin.

  • Thursday, April 17, 2008 10:59 PM
     
     

    I am trying to dynamically create the email entity's cc field through a plugin in CRM 4.0.

     

    The plugin is a step registered to the email entity on Pre-Create event.

     

    I'm having trouble building out the the cc part of the email through DynamicEntity.  If anyone can help with this, I would be very appreciative!  Thank you.

     

    Code Snippet

    if (context.InputParameters.Properties.Contains("Target") &&

    context.InputParameters.Properties["Target"] is DynamicEntity)

    {

    // Obtain the target business entity from the input parmameters.

    Dynamicentity = (DynamicEntity)context.InputParameters.Properties["Target"];

    // Verify that the entity represents an email.

    if (Dynamicentity.Name != EntityName.email.ToString()) { return; }

    }

    else

    {

    return;

    }

    try

    {

    // Build the CC List

    activityparty ap = new activityparty();

    ap.partyid = new Lookup();

    ap.partyid.Value = new Guid("{489E1C2F-90FC-DC11-A2C4-001D09050FD0}");

    ArrayList arrCC = new ArrayList();

    arrCC.Add(ap);

     

    Dynamicentity.Properties["cc"] = (Property[])arrCC.ToArray(typeof(Property));

    }

    catch (System.Web.Services.Protocols.SoapException ex)

    {

    throw new InvalidPluginExecutionException("An error occurred with the PreEmail Create plug-in.", ex);

    }