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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Form on-load error

(0) ShareShare
ReportReport
Posted on by 8

Hi, 

I have implemented colour background for a field( I know it is not supported), below is what i have written for Form on-load, it is working as expected however, i am thrown with two consecutive script error on loading the form, please help me in rectifying these:

Also we are d365 on-premise, with this code i didn't have to turn on the legacy rendering to Yes, if i do so the code doesn't work, however the errors will disappear but that was the point without turning on the legacy i wanted the code which i have now but cant get rid of errors.

The code i have written:

function Setcolour() {

var a = Xrm.Page.getAttribute("jmfloc_vulnerable").getValue();
if(a == 1)
{
window.parent.document.getElementById("jmfloc_vulnerable").style.backgroundColor = "#cc382d" ;
}
}

Errors thrown:

pastedimage1605623814215v1.png

pastedimage1605623876750v2.png

Thanks,

PS

I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 131 Super User 2026 Season 1

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 46 Most Valuable Professional

#3
NeerajPawar Profile Picture

NeerajPawar 41

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans