locked
Custom Entity Associated View Button - Is it possible? RRS feed

  • Question

  • I want to create a custom report form the selected records on the custom entity associated view grid.  I would like to place a button on the associated view that will pass the selected records, dialogarguments to the SRS report.  I understand the button is controlled by the isv.config, but do not know what node.  I do not want the button to be visible on the opportunity entity, only on the associated custom entity view.  Is this possible?  I am new to CRM and find it increasingly difficult to find answers such as this. 

    Thanks for your help.
    Tuesday, August 25, 2009 6:31 PM

Answers

  • The buttons that appear on a view cannot be set per view, so whatever buttons or menus are added so they appear on the associated view will also appear on all other views.

    To add a button to the account views, use this snippet:

            <Entity name="account">
              <Grid>
                <MenuBar>
                  <Buttons>
                    <Button Icon="/_imgs/ico_18_debug.gif" JavaScript="alert('test');">
                      <Titles>
                        <Title LCID="1033" Text="Click Here" />
                      </Titles>
                      <ToolTips>
                        <ToolTip LCID="1033" Text="Clicking the button will produce an alert." />
                      </ToolTips>
                    </Button>
                  </Buttons>
                </MenuBar>
              </Grid>
            </Entity>
    • Marked as answer by KCJodi Thursday, August 27, 2009 5:09 PM
    Wednesday, August 26, 2009 4:30 PM
  • Jodi,

    Change the entity of your snippet to your custom record type and the button will show up on the associated view as well as all other views for that entity.
    • Marked as answer by KCJodi Thursday, August 27, 2009 5:09 PM
    Wednesday, August 26, 2009 7:48 PM
  • Hey,

    In that you can try with parent.function name to call something like

    Myfunction=finction()
    {

    }


    you can call your function with

    Parent.Myfunction();


    Hope it will help !!!!!!!!!
    Mahain
    • Marked as answer by KCJodi Tuesday, September 8, 2009 2:48 PM
    Monday, September 7, 2009 2:49 PM
    Moderator

All replies

  • The buttons that appear on a view cannot be set per view, so whatever buttons or menus are added so they appear on the associated view will also appear on all other views.

    To add a button to the account views, use this snippet:

            <Entity name="account">
              <Grid>
                <MenuBar>
                  <Buttons>
                    <Button Icon="/_imgs/ico_18_debug.gif" JavaScript="alert('test');">
                      <Titles>
                        <Title LCID="1033" Text="Click Here" />
                      </Titles>
                      <ToolTips>
                        <ToolTip LCID="1033" Text="Clicking the button will produce an alert." />
                      </ToolTips>
                    </Button>
                  </Buttons>
                </MenuBar>
              </Grid>
            </Entity>
    • Marked as answer by KCJodi Thursday, August 27, 2009 5:09 PM
    Wednesday, August 26, 2009 4:30 PM
  • Thanks Richard.  The code snippet is the one I used on the opportunity entity.  It does in fact appear on the opportunity entity, but does not appear when I click the associtaed view from the left navigation.  I was hoping to be able to detech the name of the associated view grid and place a button on it.  What I am hearing you say is that it is not possible.  Why does the button on the opportunity enity not appear on the associated view?  Confusing.

    After reading this post, I was hopeful it would be possible.

    http://blog.customereffective.com/blog/2009/08/fun-with-the-crm-grid-object.html
    Wednesday, August 26, 2009 7:02 PM
  • Jodi,

    Change the entity of your snippet to your custom record type and the button will show up on the associated view as well as all other views for that entity.
    • Marked as answer by KCJodi Thursday, August 27, 2009 5:09 PM
    Wednesday, August 26, 2009 7:48 PM
  • Thanks Richard,

    That was exactly what I needed to do.  I had the button on opportunity and not on my custom entity.  I moved it and all is well.
    Now, on to attempting to pull the selected records from the grid.

    Thanks for your help.
    Thursday, August 27, 2009 5:09 PM
  • If you add a custom SSRS report for that entity, and in the report record indicate that it should "Display in lists for related record types", it will be added to the report button at the top of the associated list view for your custom entity, and one of the options will be to "Run on selected records" - this will handle passing the GUIDs and parameters to the report. Just make sure to build your report using the Filtered Views and prefixing the view aliases with CRMAF_ so it can receive all the parameters passed from the interface and maintain your security. No need for a custom button.
    Matt Wittemann, MVP for CRM (http://icu-mscrm.blogspot.com)
    Thursday, August 27, 2009 7:41 PM
    Moderator
  • We have some requirements that make it necessary for me to use a custom button.  I have my button showing up on the view.  Now, how do I get the code in the onload of the entity to work with the rows from the grid.  I am struggling with the syntax to access the code from the parent.  Can someone help me with a snippett? 
    Monday, September 7, 2009 1:09 PM
  • Hey,

    In that you can try with parent.function name to call something like

    Myfunction=finction()
    {

    }


    you can call your function with

    Parent.Myfunction();


    Hope it will help !!!!!!!!!
    Mahain
    • Marked as answer by KCJodi Tuesday, September 8, 2009 2:48 PM
    Monday, September 7, 2009 2:49 PM
    Moderator
  • Mahain,

    Thanks for the help.  but, it does not work.  Here is my error:

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>&#39;Parent&#39; is undefined</Message>
     <Line>1</Line>
     <URL>/MHC&#47;_root&#47;homepage.aspx&#63;etc&#61;10006</URL>
     <PageURL>/MHC&#47;_root&#47;homepage.aspx&#63;etc&#61;10006</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
    Monday, September 7, 2009 3:20 PM
  • I tried changing to lowercase and got this error:

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
     <Message>Object doesn&#39;t support this property or method</Message>
     <Line>1</Line>
     <URL>/MHC&#47;_root&#47;homepage.aspx&#63;etc&#61;10006</URL>
     <PageURL>/MHC&#47;_root&#47;homepage.aspx&#63;etc&#61;10006</PageURL>
     <Function></Function>
     <CallStack>
     </CallStack>
      </ScriptErrorDetails>
    Monday, September 7, 2009 3:23 PM
  • Hi,

    could you paste your code and how you are calling your function, that will help.


    Mahain
    Monday, September 7, 2009 3:24 PM
    Moderator
  • I have a custom button defined in the ISV.config.  My custom button is on the associated view(grid).  The button on the associated view calls the function in the onload of the entity: 

    <Entity name="mhcv1_saw">
    <Grid>
    <MenuBar>
    <Buttons>
    <Button Icon="/_imgs/ico/pdficon_small.gif" JavaScript="alert('call the function in onload');parent.TruckOrder()" Client="Web">
    <Titles>
    <Title LCID="1033" Text="Multiple SAW Truck Order" />
    </Titles>
    <ToolTips>
    <ToolTip LCID="1033" Text="Clicking the button will produce an the Multiple SAW Truck Order." />
    </ToolTips>
    </Button>
    </Buttons>
    </MenuBar>
    </Grid>

    Monday, September 7, 2009 3:29 PM
  • Hey,

    are you defining your function same like

    FunctionName=function()
    {

    }

    on form load as it's working for me, i tested it creating same example like you.

    Mahain
    Monday, September 7, 2009 3:46 PM
    Moderator
  • Yes I am.  Thanks for your help.  I have not written the function yet, so is simple:

    TruckOrder = function () {
    alert("multiple SAW truck order");
    }
    Monday, September 7, 2009 3:49 PM
  • Yes,

    it should work !!


    Mahain
    Monday, September 7, 2009 3:54 PM
    Moderator
  • Yes, it does work if you put the function in the proper entity!  I had my function in the associated entity not in the Opportunity where it was accessed from.  Now it works for the associated view from Opportunity.  However, another view is accessed from the main site naviagation under Sales.  The button is the same, but it does not work.  I put the function in the associated entity as well, but it still does not work.  Any ideas?
    Tuesday, September 8, 2009 2:47 PM