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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Custom javascript modifications in preparation for migration to CRM 2016

(0) ShareShare
ReportReport
Posted on by 1,577

Hello,

We are preparing to migrate from CRM2013 onpremise to cloud CRM2016. I know that DOM-accessing javascript is not supported but is there any supported method or alternative to what we were using (to color-code a field background depending on field value). - We were using document.getelementbyid("element").style.backgroundColor =

Like I say I totally appreciate this is unsupported but it WILL work in 2016 if I place "parent."before "document"

Is there any supported way of doing this - i.e. any function which I can replace all usage of "document.getelement.byId" with?

In this case Xrm.page.getAttribue("myattribute").style does not work.

Any suggestions very welcome - thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Daniel Wikell Profile Picture
    2,360 on at

    Hi

    Manipulating the style of standard UI-components will always be unsupported.

    The only supported way of accomplishing what you describe in CRM 2016 would be to create a custom HTML webresource page that contains a custom rendered version of your field. You then include this weresource in the place of the real field and hide the real field. Use scripts to update the value of the real field if changes are allowed in the custom field.

    There's an upcoming feature for the latest CRM version that is going to allow you to create custom UI controls but since you are on CRM 2016, the webresource is your only supported option.

  • Seamus Profile Picture
    1,577 on at

    Thanks Daniel, - presumably using xrm.page.getAttribute().setVisible?

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at

    Hi,

    Changing the background color is not supported in MSCRM 2016. You have to set legacy form rendering to make it work but it affects the performance. Please check the following link for more details stackoverflow.com/.../change-the-colour-of-text-field-in-dynamics-crm-2016

    If found useful, please mark this answer as a verified answer.

  • Daniel Wikell Profile Picture
    2,360 on at

    Yeah, or you could just uncheck the checkbox "Visible by default" at the field properties in the form designer, since you would always want this field to be hidden anyways.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans