web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM 365 how to apply css to the field .

(0) ShareShare
ReportReport
Posted on by 6

Hello All Experts,

I need to apply css for the fied display on the form .

any help will be appreciable.

*This post is locked for comments

I have the same question (0)
  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: CRM 365 how to apply css to the field .

    Hi,

    This would be an unsupported customization. It would be better if you create your own web resource.

    If you decide to go ahead with this anyway, you can use jquery or access the dom (using getElementById) to modify the style or class of that specific control.

    Hope this helps.

  • Suggested answer
    Rajkumar Rajaraman Profile Picture
    on at
    RE: CRM 365 how to apply css to the field .

    Unfortunately not. The UI is what it is, and it's not customizable.

  • EmployeeOcta Profile Picture
    6 on at
    RE: CRM 365 how to apply css to the field .

    Hello Aric,

    While trying to use the getElementById , it's throwing an error .

    style cannot be applied to the null object kind of.

    is there any way to avoid this.

  • EmployeeOcta Profile Picture
    6 on at
    RE: CRM 365 how to apply css to the field .

    Hello Experts,

    1. Xrm.Page.getAttribute('new_field').getValue(); xyz                 //working

    2. document.getElementById('new_field')     undefined.                //not working  

    why 2 point not able to get the value.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: CRM 365 how to apply css to the field .

    Try

    parent.document.getElementById('new_field')

    but what you're doing is unsupported customization.

  • EmployeeOcta Profile Picture
    6 on at
    RE: CRM 365 how to apply css to the field .

    Hello Experts,

    I forget to write parent as prefix earlier .

    the actual line was  parent.document.getElementById('new_field').

    as mentioned earlier it's the same UNDEFINED or null causing error.

    any other method which we could use to override this.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: CRM 365 how to apply css to the field .

    Hi,

    When you access elements from DOM, you need to specify the actual id which is different than the schema name of the field . It would be either <schemaname>_i or <schemaname>_d. You can use developer tools to get the actual id.

    You can then try this-

    var phone = parent.document.getElementById("telephone2_i");

    phone.style.color = "red";

    PS: As mentioned above, this is unsupported which means there is no guaranty that if it works now, it will always work in future :)

    Hope this help.

  • Mahendar Pal Profile Picture
    45,095 on at
    RE: CRM 365 how to apply css to the field .

    Keep in mind document.getElementById is not supported anymore so no use of putting your effort on writing your code, as it will break definitely better to go with custom html web resource and implement your logic there.

  • EmployeeOcta Profile Picture
    6 on at
    RE: CRM 365 how to apply css to the field .

    Hello Ravi, Which developer tool to be used, can you elaborate a little.

    Hello Mahendra, it was already being implemented by the other developer, now client wants the same.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: CRM 365 how to apply css to the field .

    Hi,

    The inbuilt browser developer tool (F12).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans