locked
MSCRM 2011 : Auto populate regarding attribute for the custom Activity RRS feed

  • Question

  • Hi,

    I have a parent entity called "Account" , child entity("custom activity") 

    Custom activity button placed for the Account in the home page grid.

    When i click on the custom activity button to create a new form upon selection of any account record in the grid,

    the regarding field should get auto populated with the selected record of account in the custom activity form.

    can you please suggest how to work on this through javascript

    Thanks, Toushu

    Wednesday, February 26, 2014 12:45 PM

Answers

  • When you mention clicking on the custom activity button, is that your own custom ribbon button?

    If you click on the Ribbon  > Add Tab > Other Activities Menu > Custom Activity, the regarding attribute will get auto populated as you expected.

    If it is your own custom ribbon button and if you want to achieve the same behaviour, you can use the CRM ribbon function "Mscrm.GridRibbonActions.addActivityFromGrid" from "/_static/_common/scripts/RibbonActions.js" with integer value of entity code of your custom activity, empty string parameter and Crm parameter of "SelectedControlSelectedItemReferences" as in the screenshot below. I use Visual Ribbon Editor and you may also want to set the Disable Rule and Enable Rule as the system button as well.

    But you need to aware that using any undocumented internal objects or JavaScript methods is unsupported. So, that button may break at any time when the method being used is changed any time upon update rollup installation or upgrade to CRM 2013.

    If you want to go for the completely supported solution, you might have to call a web service to get the "Name" of the select Account and open up the new custom activity using Xrm.Utility.openEntityForm and pass the Regarding Object value in the parameter.

    Set Field Values Using Parameters Passed to a Form - Setting Values for Lookup fields

    • Marked as answer by Rahul-22 Thursday, February 27, 2014 11:52 AM
    Wednesday, February 26, 2014 4:37 PM

All replies

  • When you mention clicking on the custom activity button, is that your own custom ribbon button?

    If you click on the Ribbon  > Add Tab > Other Activities Menu > Custom Activity, the regarding attribute will get auto populated as you expected.

    If it is your own custom ribbon button and if you want to achieve the same behaviour, you can use the CRM ribbon function "Mscrm.GridRibbonActions.addActivityFromGrid" from "/_static/_common/scripts/RibbonActions.js" with integer value of entity code of your custom activity, empty string parameter and Crm parameter of "SelectedControlSelectedItemReferences" as in the screenshot below. I use Visual Ribbon Editor and you may also want to set the Disable Rule and Enable Rule as the system button as well.

    But you need to aware that using any undocumented internal objects or JavaScript methods is unsupported. So, that button may break at any time when the method being used is changed any time upon update rollup installation or upgrade to CRM 2013.

    If you want to go for the completely supported solution, you might have to call a web service to get the "Name" of the select Account and open up the new custom activity using Xrm.Utility.openEntityForm and pass the Regarding Object value in the parameter.

    Set Field Values Using Parameters Passed to a Form - Setting Values for Lookup fields

    • Marked as answer by Rahul-22 Thursday, February 27, 2014 11:52 AM
    Wednesday, February 26, 2014 4:37 PM
  • Linn,

    Thank you very much for your information.
    Let me try and work around it.


    Thanks, Toushu

    Thursday, February 27, 2014 5:11 AM