web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Workflow in CRM & Email Notification

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

I am still very new to CRM Online and was thinking that getting email notifications would be easy like in SharePoint but thats not the case. Maybe i simply don't know how to do it.

So i have four main requirements and would really appreciate if someone can guide me step by step. 

- User receives Email notification when a Contact is Shared or Assigned to someone

- Email notification when a Lead is converted in to a Opportunity & Closed

I have read numerous blog posts but i get stuck and confused when it comes to choosing Process OR Work flow. Secondly i don't seem to understand the Email work flow screen and would really need some help on it.

Thanks

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Workflow in CRM & Email Notification

    Hi Kinnu,

    Thank you so much for sharing this but i am still very new to CRM and was hoping to get things done with OOTB functionality without any code.

    Are you suggesting that i cannot achieve this without code?

  • Community Member Profile Picture
    on at
    RE: Workflow in CRM & Email Notification

    Hi,

    You can write a plugin for triggering mail on sharing a record,Please check the below code:

    public void Execute(IServiceProvider serviceProvider)
    {

    IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    IOrganizationServiceFactory servicefactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    IOrganizationService service = servicefactory.CreateOrganizationService(context.UserId);

    if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)
    {

    EntityReference Staffing = ((EntityReference)context.InputParameters["Target"]);

    var staffingrecord = service.Retrieve(Staffing.LogicalName, Staffing.Id, new ColumnSet(new[] { "fullname" }));


    staffingname = Convert.ToString(staffingrecord["fullname"]);

    // User or Team for whom the record has been shared
    EntityReference sharedRecord = ((PrincipalAccess)context.InputParameters["PrincipalAccess"]).Principal;

    // System User ID who has shared the record
    Guid fromUserId = context.UserId;

    // Send An EMail
    EmailUser(service, sharedRecord, fromUserId, Staffing);


    }


    }
    private void EmailUser(IOrganizationService service, EntityReference sysUser, Guid fromUserId, EntityReference regarding)
    {

    Entity email = new Entity("email");
    email.Attributes.Add("subject", "New Staffing Record Has been Shared With You");
    email.Attributes.Add("description", " " + "A Staffing Record has recieved for the LEAD:" + " " + staffingname + "Please view the record shared with you " + " ");
    email.Attributes.Add("regardingobjectid", regarding);

    EntityReference from = new EntityReference("systemuser", fromUserId);
    EntityReference to = sysUser;

    Entity fromParty = new Entity("activityparty");
    fromParty.Attributes.Add("partyid", from);
    Entity toParty = new Entity("activityparty");
    toParty.Attributes.Add("partyid", to);

    EntityCollection frmPartyCln = new EntityCollection();
    frmPartyCln.EntityName = "systemuser";
    frmPartyCln.Entities.Add(fromParty);

    EntityCollection toPartyCln = new EntityCollection();
    toPartyCln.EntityName = "systemuser";
    toPartyCln.Entities.Add(toParty);

    email.Attributes.Add("from", frmPartyCln);
    email.Attributes.Add("to", toPartyCln);

    //Create an EMail Record
    Guid _emailId = service.Create(email);

    // Use the SendEmail message to send an e-mail message.
    SendEmailRequest sendEmailreq = new SendEmailRequest
    {
    EmailId = _emailId,
    TrackingToken = "",
    IssueSend = true
    };

    SendEmailResponse sendEmailresp = (SendEmailResponse)service.Execute(sendEmailreq);
    }

    Trigger Plugin on:GrantAccess Message

  • Community Member Profile Picture
    on at
    RE: Workflow in CRM & Email Notification

    Anyone???

    I am stuck and i think its just some small step which i am missing...

  • Community Member Profile Picture
    on at
    RE: Workflow in CRM & Email Notification

    Hi Guys,

    Ok i am back after vacation and this is what i did, clicked on Settings >>> Processes from the menu then did the following

    • Category – Workflow
    • Entity – Lead
    • Type – Opportunity Work Flow
    • Clicked Ok

    Then i set it up as Start when the RECORD is created and i select Organization in Scope.

    Notification-Setting.jpg

    Then I did the email notification part which is shown in the below screen

    Notification-Setting.jpg

    Is this right? 

    The email notification is not clear and it looks really crappy.

    email-notification.jpg

    Scenario: I am trying to generate a email notification once a LEAD is converted into OPPORTUNITY, Owner and all CRM Users will get a email notification. 

    Problem:

    Right now only the owner of the Lead gets the email notification

    The email notification does not contain the Lead Name or Account Name? Confirm Interest is just part of the Checklist.

    The way it is displayed is kinda crappy.

    Any help or suggestion? Please note that i am just getting started with CRM so screenshots or step by step would be ideal.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Workflow in CRM & Email Notification

    1. Run a workflow on assignment and in that workflow you can send an email. However, share trigger is not available in workflows, you will have to write a plugin to do so.

    2. Run a workflow on status change of lead. Check if the status is closed and send the email.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#3
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans