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)

Business Rules

(0) ShareShare
ReportReport
Posted on by

Hello,

I have two currency fields called "Rent1" and "Rent2". Neither of them are calculated fields. I have set up a Business Rule on Rent2 such that if Rent1 contains any data, Rent2 will be set to that value. However, I also want the field Rent2 to be modifiable manually but the business rule prevents me from doing so. For example, Rent1 = 1000€. So by my business rule Rent2 will also be set at 1000€. If I try to change Rent2 manually, say, to 2000€, it sets back the field back to 1000€ on saving. Is there any way of keeping the Business rule and making the field modifiable manually?

Thanks in Advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    TomTK Profile Picture
    on at

    If

    Rent2 contains no data 

    Rent1 contains data

    then

    copy Rent1 to Rent2.

    or have a workflow copy rent1 to rent2 whenever rent1 is changed.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    This way it will always reset value always, If you just want to set value of Rent2 once based on Rent1 then you can use default value instead of set value action, But it will just set value of Rent2 at the time of create, so you can change value of Rent2 after that.

    Hope it will help.

    Thanks

  • Suggested answer
    Community Member Profile Picture
    on at

    You'll need to create another attribute for manual override of type boolean/TwoOptions. Idea is when you enter the value on Rent2 field, set the manual override to True and in your business rule check if manual override is false only then copy from Rent1 to Rent2 field.

    The problem with this might be that when it runs the first time from Rent1 to Rent2, it may invoke the onChange for Rent2 which you'd use to set the manual override to true. I would say, see if you can hookup the keypress JS event on Rent2 field and then use that to set the manual override to true. Once that is done, the business rule won't copy from Rent1 to Rent2, you can toggle it back and business rule will start working again.

  • Verified answer
    Community Member Profile Picture
    on at

    A Business Rule is the wrong kind of solution here. A Workflow that fires on the change of a rent 1 field and fills the rent 2 field will be the better option.

  • Suggested answer
    Neil Parkhurst Profile Picture
    10,727 User Group Leader on at

    You could use a workflow but if you want rent2 to be altered when rent1 is changed immediately. (i.e. before the record is saved.) Then a JavaScript function on the onchange of rent1 might be better. Something like this ....

    function OnChange_Rent1() {

     Xrm.Page.getAttribute("new_rent2").setValue(Xrm.Page.getAttribute("new_rent1").getValue());

    }

  • Verified answer
    Community Member Profile Picture
    on at

    Thank you very much for all your suggestions. What worked for me was that I created a real-time workflow with the two following conditions:

    1. If Rent1 contains any data, then update Rent2 to that value

    2. If the value contained in the Rent2 field is different from that of Rent1, then update Rent2 = Rent2

    I know it's not an orthodox way of writing conditions, but it worked for me. Now whenever I modify Rent2, its value stays the same

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