none
CRM 2011: Sending an E-mail on sharing record

    Question

  • Hi all, I have a requirement where I need notify a user when a record is shared with him, I can't find out how to do it out of the box.

    I tried to do it using workflows, java script and plugins

    Please advise..

    Monday, July 09, 2012 12:36 PM

Answers

  • Hi Mostafa,

    You can use following lines of code to get the user to whom the record is getting shared.

    EntityReference sysUser = ((PrincipalAccess)context.InputParameters["PrincipalAccess"]).Principal;
    Guid sysUserId = sysUser.Id;

    PS: if we have shared a record to multiple users(lets say 2 users) then the plugin will be triggered multiple times(twice).

    Hope it helps...!! :)


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Tuesday, July 10, 2012 8:25 AM
  • Hi Mostafa,

    Register your plugin on "GrantAccess" message.

    Let's say"Message - GrantAccess" and "Entity - lead" then your plugin will be triggered on sharing of the lead entity record.

    Hope it helps....!! :)


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Monday, July 09, 2012 5:53 PM

All replies