locked
Dynamic Email Attachment RRS feed

  • Question

  • Need dynamic attachment to the email created via workflow. The approach i am thinking is below

    Create a workflow with "Create email task activity" - Which creates email

    Create a custom workflow activity, which takes the emailID of the email created in the previous step and attach the relevant document of the regarding entity record

    In theory looks good, but when i use "E-mail Message" to be input parameter value, i was expecting GUID of the email, but workflow is passing the email subject. Any idea how i can pass the email Guid as input parameter to my custom workflow activity.

    Thanks

    Sydney

    Friday, February 11, 2011 12:06 AM

Answers

  • "E-mail Message" is the correct choice, but you should actually be passing a Lookup property; in your custom workflow activity, define your input property similar to the following:

    public static DependencyProperty EmailProperty = DependencyProperty.Register("Email", typeof(Lookup), typeof(MyCustomWorkflow));
    
    [CrmInput("Email entity instance")]
    public Lookup Email
    {
    	get
    	{
    		return (Lookup)base.GetValue(EmailProperty);
    	}
    	set
    	{
    		base.SetValue(EmailProperty, value);
    	}
    }
    
    

    You should then be able to set the input property to the "E-mail Message" as you have attempted, using:

    {E-mail Message(Create (E-mail))}

     


    --pogo (pat)
    Friday, February 11, 2011 12:50 AM
  • Pogo,

    you forgot to add following attribute before Lookup property to make it work like:

    [CrmReferenceTarget("email")]


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Friday, February 11, 2011 3:49 AM
    Moderator

All replies

  • "E-mail Message" is the correct choice, but you should actually be passing a Lookup property; in your custom workflow activity, define your input property similar to the following:

    public static DependencyProperty EmailProperty = DependencyProperty.Register("Email", typeof(Lookup), typeof(MyCustomWorkflow));
    
    [CrmInput("Email entity instance")]
    public Lookup Email
    {
    	get
    	{
    		return (Lookup)base.GetValue(EmailProperty);
    	}
    	set
    	{
    		base.SetValue(EmailProperty, value);
    	}
    }
    
    

    You should then be able to set the input property to the "E-mail Message" as you have attempted, using:

    {E-mail Message(Create (E-mail))}

     


    --pogo (pat)
    Friday, February 11, 2011 12:50 AM
  • Pogo,

    you forgot to add following attribute before Lookup property to make it work like:

    [CrmReferenceTarget("email")]


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Friday, February 11, 2011 3:49 AM
    Moderator
  • Cheers Andriy.


    --pogo (pat)
    Friday, February 11, 2011 4:38 AM
  • Thanks guys, much appreciated
    Thursday, March 3, 2011 4:22 AM