Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / Show/Hide web resource...
Sales forum
Suggested answer

Show/Hide web resource on a form based on one of the field values of a related look-up record

Posted on by 19

I am currently showing/hiding a web resource on my Customer (account) form based on whether a checkbox has been checked indicating that the Customer requires COVID-19 vaccination to work on their jobs.  This is working fine using Javascript on the Customer form's onload event:

function showCOVID19VaccineRequirementReminder(executionContext) {
 var formContext = executionContext.getFormContext();
 var COVID19VaccineRequirementYesOrNo = formContext.getAttribute("new_covid19vaccinerequirement").getValue();
        if (COVID19VaccineRequirementYesOrNo === true) {
            Xrm.Page.ui.setFormNotification("Verify the COVID-19 vaccination status of relevant team members assigned to perform any work for this client.","WARNING");
            Xrm.Page.getControl("WebResource_COVID19VaccineRequirementAlertReminder").setVisible(true);
        }
        else {
            Xrm.Page.getControl("WebResource_COVID19VaccineRequirementAlertReminder").setVisible(false);
        } 
}

Now, I want the same web resource to show/hide on the form for Proposal records based on whether the selected Customer look-up record has that checkbox checked.  Is there a way to get the checkbox field value from the related look-up Customer record, either using Javascript or a calculated field on the Proposal record?  I tried creating a calculated field, but for some reason the Customer field is not showing in the list of fields available when setting the calculated field's Action.

Categories:
  • CS-12081540-0 Profile Picture
    CS-12081540-0 7 on at
    Show/Hide web resource on a form based on one of the field values of a related look-up record
    Almost 3 years later and this post is still super helpful! The code you shared is exactly what I needed, thank you!!
  • Suggested answer
    Nya Profile Picture
    Nya 29,054 on at
    RE: Show/Hide web resource on a form based on one of the field values of a related look-up record

    Hi,

    Please refer to the answer in the following issue, which is similar to yours.

    (+) Javascript - Checking the value of a field on parent entity? - Microsoft Dynamics CRM Forum Community Forum

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans