locked
CRM2013 Ribbon Workbench - Help and guidance needed to get started RRS feed

  • Question

  • CRM2013

    I have read and not managed to work out how to accomplish what I think should be a simple task. I have created a custom entity called new_directDebits, which hold child records from Accounts. On the accounts form using the ribbon workbench I have created a button (DirectDebit). What i want to do is when the direct debit button is clicked,  the quick view form for new_directsebits is shown in a pop out window / modal dialog  with the related record.

    I would like to do this through the ribbon workbench so that I learn something.  I have many custom entities that hold child records to accounts, and using a button and pop will be better for our mode of operation than placing them directly on the form. Has anyone else done this  or can help with guidance in archiving this goal ?


    Dont ask me .. i dont know


    • Edited by Pete Newman Wednesday, March 5, 2014 6:02 PM spelling
    Wednesday, March 5, 2014 6:00 PM

Answers

  • Hi Ahmad.

    This is going to sound really stupid, but I can not get my head round this.

    If I delete the new_directdebit entity, would you be able to explain what / how i need to set the entity up and what would need to go on the accounts form to make this work.

    Once I have managed this once I will be able to carry on with the development and expand on all the good work you have helped me with


    Dont ask me .. i dont know

    • Marked as answer by Pete Newman Tuesday, March 18, 2014 10:47 PM
    Thursday, March 6, 2014 6:58 PM

All replies

  • We did something similar recently that you are trying to achieve.

    If you want to create an overlay kind of thing, try this link:

    CRM 2013 Overlay

    Or if you want to pop open a new window altogether call something similar from your JS function that is invoked by a ribbon button:

    var clientURL = Xrm.Page.context.getClientUrl();
     clientURL = clientURL + "/main.aspx?etn=salesorder&extraqs=param_pamarm1%3Dtrue%26param_param2%3d%257b" + Xrm.Page.data.entity.getId().substring(1, 37) + "%257d&histKey=469645694&newWindow=true&pagetype=entityrecord";
     window.open(clientURL, "", "status=0,resizable=1,width=1000px,height=600px");

    Ahmad

    • Proposed as answer by Ahmad Pirani Wednesday, March 5, 2014 7:46 PM
    Wednesday, March 5, 2014 7:00 PM
  • Hi Ahmad,

    Thank you for the response and code snippet.

    Using your code as a template , I have managed to create the button, and when clicking the button, I get the pop out window for the custom entity. The custom entity has a lookup to accounts ( new_licence ).

    I don't fully understand how from my attempted coding below how to open that form with the correct record in it if the record exists in new_directdebits.

    I would like to open that form and populate the licence look up from the parent record if no record exists in new_directdebit.

    So if I am in account record name = '123456' and click the ribbon button, if there is an active record in new_directdebits then it will be displayed, else the form will be displayed as a new record with the Licence pre filled.

    In the new_directdebit entity the lookup field is called new_licence

    my code

    function TestDD()
    {
    var clientURL = Xrm.Page.context.getClientUrl();
      clientURL = clientURL + "/main.aspx?etn=new_directdebitmandate&newWindow=true&pagetype=entityrecord";
      window.open(clientURL, "", "status=0,resizable=1,width=1000px,height=600px");
    }

    thank you for any help on this


    Dont ask me .. i dont know


    • Edited by Pete Newman Thursday, March 6, 2014 3:02 PM added code snippet
    Thursday, March 6, 2014 3:00 PM
  • In your function that you invoke from the Account ribbon button, add if/else condition. Something similar to below code.

    // JavaScript on the click of Account ribbon button
    function openDirectDebit()
    {
    	if (Xrm.Page.getAttribute("new_directdebit").getValue() == null)
    	{
    		var clientURL = Xrm.Page.context.getClientUrl();
    		clientURL = clientURL + "/main.aspx?etn=new_directdebit&extraqs=new_licence2%3d%257b" + Xrm.Page.data.entity.getId().substring(1, 37) + "%257d&histKey=469645694&newWindow=true&pagetype=entityrecord";
    		window.open(clientURL, "", "status=0,resizable=1,width=1000px,height=600px");
    	}
    	else
    	{
    		var newDirectDebit = Xrm.Page.getAttribute("new_directdebit").getValue()[0].id;
    
    		var clientURL = Xrm.Page.context.getClientUrl();
    		clientURL = clientURL + "/main.aspx?etn=new_directdebit&id=" + newDirectDebit + "&extraqs=new_licence2%3d%257b" + Xrm.Page.data.entity.getId().substring(1, 37) + "%257d&histKey=469645694&newWindow=true&pagetype=entityrecord";
    		window.open(clientURL, "", "status=0,resizable=1,width=1000px,height=600px");
    	}
    }

    Thursday, March 6, 2014 4:37 PM
  • HI Ahmad,

    Thank you for your patience. I must be doing something wrong. When trying that code i just get a  window with an error has occurred.

    I am thinking it is more than likely that I do not have the relationship set correctly between Accounts and new_directdebit

    The button is on the Accounts form. should I have a field on the accounts form to the new_directdebit entity? im so confused


    Dont ask me .. i dont know

    Thursday, March 6, 2014 5:42 PM
  • Of course you would need have the ID of the entity record you are trying to pop open for an existing one.
    Thursday, March 6, 2014 6:13 PM
  • Hi Ahmad.

    This is going to sound really stupid, but I can not get my head round this.

    If I delete the new_directdebit entity, would you be able to explain what / how i need to set the entity up and what would need to go on the accounts form to make this work.

    Once I have managed this once I will be able to carry on with the development and expand on all the good work you have helped me with


    Dont ask me .. i dont know

    • Marked as answer by Pete Newman Tuesday, March 18, 2014 10:47 PM
    Thursday, March 6, 2014 6:58 PM