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)

Prevent a locked and read only field value from being written over by a business rule.

(0) ShareShare
ReportReport
Posted on by

A client asked me for what I thought was an unusual request.

The client wants to store the value of the estimated revenue value in a field that will then lock and not change.

We can call that field Original Estimated Revenue.

I can use a simple business rule to set the value to what ever is entered into Estimated Revenue and lock the filed but that will not keep it from changing when  the estimated revenue is changed.   If I set the Original Estimated Revenue field to read only, the business rule will still replace the value when the Estimated revenue field changes.

The PM thought this would only take a few hours, but I'm playing with some logic in a business rule to reach this goal. Any Ideas are welcome. 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    I think this may work - You could put a check in business rule to update only if the field "Original Estimated Revenue" doesn't contain data.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    I am not sure, but this may cause the field to lock , and , then, even if there is a mistake and the estimated revenue is corrected before the record is saved, original EST value might not get updated.

    Another option would be to use a real time workflow to set original EST value when the record is saved(same condition.. if it's empty and there is a value in the EST revenue field)

    Then you can simply make that field read-only on the form(but only after you have created a workflow:) Or it will be locked in the workflow editor as well)

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    I agree with Alex.

    The better option would be to achieve this requirement using workflow instead of business rules. This will ensure that the final value entered in the Estimated Revenue is saved in Original Estimated Revenue.

  • Community Member Profile Picture
    on at

    I will try both approaches.   A java script that sets the field to read only still will allow the field to be over written by the business rule as soon at the Estimated Revenue  is changed.   Thanks, I'll let you know how this works.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    You can always run a plugin on the Update Message of the Est. Value attribute and pass the before/after values.

    If the before value is empty (first time) allow it to update, if not throw an exception.

    You should still lock the field once it has a value in it.

  • Community Member Profile Picture
    on at

    Well, in the end, I used a combo of workflow and a business rule.

    But it was frustrating , because my solution worked in my lab but not in their UAT.   

    • It turns out that someone had created a workflow while I was working on the instance and that was killing the results in mine.   It was not there before, so I think the admin got a bit playful.  
    • I locked the field with a Business rule.
    • Then I created a real time workflow that populate the "Original Estimated Revenue" field with any value in the "Estimated Revenue" Field when the record was official "Created".
    • I used a conditional branch in the real time workflow to stop the workflow if "Original Estimated Revenue" contained data..    This was all one step.
    • There after I customized the inline view of the opportunity product entity with a new Unit cost field and calculated fields.  
    • When the user adds products in their custom grid on the opportunity form, they then get the chance to do a "Write In" method that finalized the cost for that potential yearly order.
    • I used a rollup field on the opportunity form to aggregate all the products chosen in the grid to a value on the opportunity form.
    • I used a business rule after that to update the value in Estimated revenue.
    • As products and amounts are changed in the sub grid, the Estimated Revenue field is updated

    Thanks for letting me bounce this off you friends.

  • Suggested answer
    Community Member Profile Picture
    on at

    Thank you Ravi and Alex for your suggestions.  

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