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)

CRM 2013 Javascript OnLoad error. There was an error with this field's customized event.

(0) ShareShare
ReportReport
Posted on by 45

I wrote this script for CRM 4.0. It worked when we upgraded to 2011 but now that we made the change to 2013 we are having issues. I have updated the code to work with 2013 but we are still receiving an error message when the form loads. Basically it is supposed to enable access to a client's folder within windows explorer from the account from.

Below is the code:

function Form_OnLoad()

{

if (Xrm.Page.getAttribute('new_folder").getValue() != null);

{

var clientfolder = Xrm.Page.getAttribute("new_folder").getValue();

document.getElementById("new_folder").style.color = "#DF0001";

document.getElementById("new_folder").style.textDecorationUnderline = true;

document.getElementById("new_folder").style.fontWeight = "bold";

document.getElementById("new_folder").onclick = function();

{

window.open(clientfolder);

}

}

if (Xrm.Page.getAttribute('new_orgchart").getValue() != null);

{

var orgchart = Xrm.Page.getAttribute("new_orgchart").getValue();

document.getElementById("new_orgchart").style.color = "#DF0001";

document.getElementById("new_orgchart").style.textDecorationUnderline = true;

document.getElementById("new_orgchart").style.fontWeight = "bold";

document.getElementById("new_orgchart").onclick = function();

{

window.open(orgchart);

}

}

}

Everything is correct in the form properties with respect to Form Libraries and Event Handlers as well as within the Field Properties but we still continue to receive the error message found below.

There was an error with this field's customized event.

Field:window

Event:onload

Error:'Form_OnLoad' is undefined

Any help would be greatly appreciated.

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Peter72 Profile Picture
    1,815 on at

    2 lines of code were incorrect (you have to change the leading singlequote to doublequote and remove the semicolon):

    Change

    if (Xrm.Page.getAttribute('new_folder").getValue() != null);

    to

    if (Xrm.Page.getAttribute("new_folder").getValue() != null)

    and

    if (Xrm.Page.getAttribute('new_orgchart").getValue() != null);

    to

    if (Xrm.Page.getAttribute("new_orgchart").getValue() != null)

  • Verified answer
    Peter72 Profile Picture
    1,815 on at

    and remove the semicolon again on your inner functions:

    document.getElementById("new_folder").onclick = function();

    to

    document.getElementById("new_folder").onclick = function()

    and

    document.getElementById("new_orgchart").onclick = function();

    to

    document.getElementById("new_orgchart").onclick = function()

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