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 365 | Integration, Dataverse...
Answered

Business rule (show\hide fields) is not working

(0) ShareShare
ReportReport
Posted on by

Hello, I have a custom entity "Bank requisites". When a user creates it, he must enter a country. If the country is Russia, the field "Not-resident" must set to "No". If another country is set, the field "Not-resident" must be "Yes". This business rule looks like:

_1104350437044B043C044F043D043D044B043904_.png

I create a new record of "Bank requisites" from Account form, where subgrid is placed.

7140._1104350437044B043C044F043D043D044B043904_2.png

The quick create is disabled on entity "Bank requisites", so the system opens main form:

_1104350437044B043C044F043D043D044B043904_3.png

Then I input "Russia" in Country field. I choose it from look-up on another entity "Location".

_1104350437044B043C044F043D043D044B043904_34.png

I wait, that "Non-resident" will change to "No", but this is not happening. 

_1104350437044B043C044F043D043D044B043904_5.png

And only after saving the record, field "Not-resident" sets to "No" as it must.

Please help, why the rule doesn't work?

I checked the scope, the other business-rules, the field is present on form, condition is met, I have published many times the solution, and so on...

What else can I try?

Thanks in advance!

I have the same question (0)
  • Verified answer
    Wahaj Rashid Profile Picture
    11,321 on at

    Hi,

    Thank you for your query.

    Did you check if you have any other business rules or JavaScript functions conflicting with this rule?

    Visually this rule seems to be fine.

    Also, try the following:

    • Create a Bank requisite form outside the sub-grid.
    • Disable the business rules on this entity (temporarily) and test the behavior.
  • Community Member Profile Picture
    on at

    Hi,

    As Wahaj Rashid said, there is nothing wrong with the design of the Business rule, you can check it as he said.

    Or you can try to use JavaScript to determine the value of country and set Not-resident to be Yes or No.

    You can create JavaScript code here first:

    pastedimage1627286897407v1.jpeg

    Then you need to add the OnChange event to the country field:

    pastedimage1627286937579v2.jpeg

    You can refer to the following code:

    function disableField(executionContext){
                    var formContext = executionContext.getFormContext();
                    var country = formContext.getAttribute("country").getValue();
                    if(country == "Russia"){
                                    
                    }else{
                                    
                    }
    }
    

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Frank Gong

  • Community Member Profile Picture
    on at

    Thank you, Wahaj Rashid! Our developer has checked and found a script, whicn was making similar logic, and conflicted with my business rule.

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 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 49 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans