Dynamics 365 Form Non-Event Dependencies

Leave a comment

In our Dynamics 365 forms, there are measures we can take to ensure fields that are being used by JavaScript are not removed from forms.

For example, let’s say we have a function to display the Website URL entered by the user:

function displayWebsite()
{
 try {
 alert("The website entered is: " + Xrm.Page.getAttribute("websiteurl").getValue(););
 }
 catch (e) {
 alert(e.message);
 }
}

Let’s add this displayWebsite function to the form OnLoad event:

Now, select an account. You will see the pop-up:

Now what happens if we remove the website field from the form. We run into the error:

To prevent this from happening, we can go to Form Properties and select the Non-Event Dependencies, and add the website field:

Now we will see a lock symbol next to the website field:

The field has been locked as can be seen in the field properties:

If we try to remove the field, we get the message:

To change the field properties back, you can remove the field from the form dependencies and uncheck the lock field property.

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *