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!

  • Community Member Profile Picture
    on at
    RE: Business rule (show\hide fields) is not working

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

  • Community Member Profile Picture
    on at
    RE: Business rule (show\hide fields) is not working

    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

  • Verified answer
    Wahaj Rashid Profile Picture
    11,321 on at
    RE: Business rule (show\hide fields) is not working

    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.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Adis Profile Picture

Adis 136 Super User 2025 Season 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 81

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 77 Super User 2025 Season 1

Product updates

Dynamics 365 release plans