locked
How to change innerHTML of form in MS Dynamics CRM 2015 form? RRS feed

  • Question

  • I have a form in MS CRM 2015 Online. it was updated to 2015 from 2013 recently. I have a requirement such that i have to show multi select check boxes on CRM form. In CRM 2013 i have an option set with some options, with those options i am forming HTML with check boxes using script and am changing HTML. In CRM 2013 i had changed form UI using document.getelemntByID("#element").innerHTML.

    but in CRM 2015 javascript is not working. i am unable to get element using doument.getelementbyID.

    I have tried with HTML Web resources. even this is not working in CRM 2015 online.

    I am unable to find alternative for this requirement. can any one of suggest me on this?

    Wednesday, October 7, 2015 7:23 AM

Answers

  • Hi Naveen,

    I understant that you have option set with some options - you want to show it as multi select check boxes.

    You can do it using below steps:


    1. Add one Html WebResource in the Crm entity form

    • Add one Muilti check box control in that html
    • Retrive the OptionSet Options and its value.
    • Bind that OptionSet metadata (Options and its value) in Muilti check box control.
    • Write some code to save the data of selected value of Muilti check box control in the newly created crm hidden field (reffer #2)

    2. Add one hidden text field in Crm entity form to save the data/vlaue of Muilti check box control.


    Reffer : http://mahadeomatre.blogspot.in/2015/02/convert-option-set-to-multi-select.html 





    • Edited by Piyush Parate Wednesday, October 7, 2015 8:46 AM
    • Proposed as answer by Piyush Parate Wednesday, October 7, 2015 8:47 AM
    • Unproposed as answer by Piyush Parate Wednesday, October 7, 2015 9:25 AM
    • Marked as answer by HIMBAPModerator Saturday, November 7, 2015 11:11 AM
    Wednesday, October 7, 2015 8:42 AM

All replies

  • Hi Naveen,

    I understant that you have option set with some options - you want to show it as multi select check boxes.

    You can do it using below steps:


    1. Add one Html WebResource in the Crm entity form

    • Add one Muilti check box control in that html
    • Retrive the OptionSet Options and its value.
    • Bind that OptionSet metadata (Options and its value) in Muilti check box control.
    • Write some code to save the data of selected value of Muilti check box control in the newly created crm hidden field (reffer #2)

    2. Add one hidden text field in Crm entity form to save the data/vlaue of Muilti check box control.


    Reffer : http://mahadeomatre.blogspot.in/2015/02/convert-option-set-to-multi-select.html 





    • Edited by Piyush Parate Wednesday, October 7, 2015 8:46 AM
    • Proposed as answer by Piyush Parate Wednesday, October 7, 2015 8:47 AM
    • Unproposed as answer by Piyush Parate Wednesday, October 7, 2015 9:25 AM
    • Marked as answer by HIMBAPModerator Saturday, November 7, 2015 11:11 AM
    Wednesday, October 7, 2015 8:42 AM
  • Hi,

    Thank you for your response. I have tried the same as you told. i have added a HTML Web Resource and implemented the same logic in my CRM 2015 online as you specified. I am unable to run my javascript written in the HTML Webresource. so i am unable to do this. i have just written all my JS inside the script tag in the HTML Weresource. Will this one works in CRM 2015 online? any ideas?


    Naveen

    Wednesday, October 7, 2015 9:06 AM
  • Naveen - debug your scripts (Reff...)
    Wednesday, October 7, 2015 9:20 AM
  • I am doing it. i had put break points there. even single one is not hitting. I will try once again.

    Naveen

    Wednesday, October 7, 2015 9:23 AM
  • Are you using window.load function into the script tag?

    // function will be called when web resource is loaded on Form.
    window.onload = function ()
    {
            //YOUR code
    }



    OR If you have JQuerry refference:
    // function will be called when web resource is loaded on Form.
    $(document).ready(function () { //YOUR code });



    • Edited by Piyush Parate Wednesday, October 7, 2015 9:33 AM
    • Proposed as answer by Piyush Parate Wednesday, October 7, 2015 2:46 PM
    Wednesday, October 7, 2015 9:28 AM
  • No. I am just writing a function, and getting all the options from option set and forming multicheckbox html with those options and am trying to add that html to CRM form.

    Naveen

    Wednesday, October 7, 2015 9:32 AM
  • You have to use it like

    window.onload = function ()
    {
        ConvertDropDownToCheckBoxList();
    }

    • Proposed as answer by Piyush Parate Wednesday, October 7, 2015 2:46 PM
    Wednesday, October 7, 2015 9:39 AM
  • Ok Thank you. I will try this.

    Naveen

    Wednesday, October 7, 2015 9:43 AM
  • This is working fine. 

    I was using <body onload="ConvertDropDownToCheckBoxList();">, it is not working.

    instead now i am using window.onload, this is working fine.

    Thanks a lot boss!!! :)


    Naveen

    Wednesday, October 7, 2015 1:23 PM