How to Open Create Activity Form on click of Ribbon Button with Regarding field populated with appropriate information? RRS feed

  • Question

  • Hi,
    I've created a new Ribbon Button "Email" on a Custom entity. On click of "Email" ribbon button it should open a Create New Email form and should set the regarding field with Custom Entity Record name. I'm able to open up the New Email form on click of "Email" Ribbon Button using Java Script, but facing issue while setting up Regarding field on the Email form? I've gone through the msdn link below and as per this article we cannot set value for Regarding/Partylist lookups using parameters passed.


    Is there any solution/workaround to populate Regarding lookup using Java Script in mentioned scenario?

    Friday, January 4, 2013 7:27 PM


  • Hi, If your entity is activity enabled, you should have the 'Add' tab, that shows a link to add an email to the record and automatically sets the regarding field. If you need to create a similar button for some reason, you can use the Ribbon Workbench to do this. You start by creating a new command that calls the 'Mscrm.RibbonActions.addActivityOnForm' or 'Mscrm.GridRibbonActions.addActivityFromGrid' functions in /_static/_common/scripts/RibbonActions.js. These are the commands that the standard buttons call from the form and grid buttons respectively.They will set the regarding field for you as per the out of the box buttons.

    The easiest way of doing this is by using one of the out of the box commands and modifying it.

    1) Load the entity into the Ribbon Workbench for Dynamics CRM

    2) Open the Home Page ribbon 

    3) Select the ' Add' Tab

    4) Select the 'Email' button and use 'right click' -> 'Customise Command' (NOT 'Customise Button')

    5) Find the command in the 'Solution Elements->Commands'

    6) Rename it to 'new.AddCustomActivityToSelectedRecord'  -or something similar

    7) Create a new button and associate with this command.

    8) Repeat to add the Form Ribbon Button.


    Scott Durow
    Read my blog: www.develop1.net/public     Follow Me on Twitter
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Friday, January 4, 2013 9:13 PM