locked
is there any way to load custom CSS into MS CRM 2016 Form - Unsupported method also fine!! RRS feed

  • Question

  • is there any way to load custom CSS into MS CRM 2016 Form ? Unsupported method also fine!!

    I see couple of posts on MS CRM 2015 Form, but i tried those scripts which are not working in CRM 2016. I wanted to reduce space between the sections in a particular Tab. Please suggest.

    Thursday, June 22, 2017 7:10 PM

All replies

  • Hello,

    Can you please provide urls to posts you mentioned?


    Dynamics CRM/Business Solutions MVP
    Read My blog

    Thursday, June 22, 2017 7:45 PM
    Moderator
  • http://anterocrm.com/microsoft-dynamics-crm-cascading-style-sheets-part2/

    https://adisys.wordpress.com/2014/05/12/showcrmborder/

    If we enable Use legacy form rendering to Yes then the custom css working as expected. So something related to the Turbo forms. 

    Thursday, June 22, 2017 8:11 PM
  • MS CRM 2016 Unsupported code to load the CSS. To make it works in CRM 2016, we may need to add parent object to document.

    CRM 2016:

    var head = parent.document.getElementsByTagName('head')[0];
        var link = parent.document.createElement('link');

    CRM 2015:

    var head = document.getElementsByTagName('head')[0];
        var link = document.createElement('link');

    function LoadCSS(path) {
        var head = parent.document.getElementsByTagName('head')[0];
        var link = parent.document.createElement('link');
        link.rel = 'stylesheet';
        link.type = 'text/css';
        link.href = path;
        link.media = 'all';
        head.appendChild(link);
    }

    Thursday, June 22, 2017 8:43 PM
  • CSS File:

    #MainTab_content div.ms-crm-tabcolumn1 { padding-left: 0px; }
    TABLE.ms-crm-FormSection { margin-left: 0px; }

    Thursday, June 22, 2017 9:37 PM