Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Lock Estimated Revenue Field - Opportunity D365 UI

  • 1.  Lock Estimated Revenue Field - Opportunity D365 UI

    Posted Dec 19, 2019 03:34 AM
    Hi,

    So I would like to lock the Estimated revenue field on the Opportunity record with the Unified Interface due to us manually calculating our revenue based on a fee structure that OOTB product setup is unable to handle, I am defaulting the calculation to the "User Provided" option to enable manual entering of the data already.

    All the obvious methods fail, business rules, JS etc, I assume this is due to the field being a special field given it can be calculated, anyone managed to achieve this?

    I'd like to NOT have to go down the route of creating a custom estimated revenue field, removing the OOTB box one from the form and then copying the data over via the API in some way, feels like complete overkill for what should be very easy and having 2 fields that hold the same info is bad!

    Thanks

    Mike

    ------------------------------
    Michael Wink
    Reigate
    ------------------------------
    Conference-CRMUG_200x200


  • 2.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    TOP CONTRIBUTOR
    Posted Dec 19, 2019 07:40 AM
    @Michael Wink

    I want to make sure I understand your requirement. You want this calculated field to be USER EDITABLE only. Is this correct?

    ------------------------------
    Rex Kenley Tan, MCSA, MCSD
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------

    Conference-CRMUG_200x200


  • 3.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    Posted Dec 19, 2019 07:52 AM
    Sorry, to explain better, the field is currently user calculated (by that I mean I have a calculation plugin that runs out fee calculation and saves the value to the Estimated revenue field). As I am calculating the Estimated Revenue I want the field to be READ ONLY, but all attempts to do so via the means mentioned has failed!

    Hope that makes more sense!?

    Cheers

    Mike

    ------------------------------
    Michael Wink
    Willis Towers Watson
    Reigate
    ------------------------------

    Conference-CRMUG_200x200


  • 4.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    TOP CONTRIBUTOR
    Posted Dec 19, 2019 07:58 AM
    Yes, that is much better.

    Can you please post your js code?

    ------------------------------
    Rex Kenley Tan, MCSA, MCSD
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------

    Conference-CRMUG_200x200


  • 5.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    Posted Dec 19, 2019 08:33 AM
    Hi,

    I am using the same code I've used man 00's of times before, so I'm 100% sure it's not the issue, especially as it also doesn't work with business rules, but it is specific to the Estimated Revenue field on Opportunity.

    formContext.getControl('estimatedvalue').setDisabled(true);

    Strangely this was happening about a month ago and I sidelined it, it's only as I joined the CRMUG yesterday I thought about posting. I've just tried again using the above code onLoad of the opportunity form and it's working correctly, however I've just seen the field become randomly enabled again!

    There is no other code JS code on the form at all so it's not being reset elsewhere.

    I also forgot to mention that is you disable the field on the form designed that has no effect on the published form, it simply ignores the fact that the field is disabled!

    I'll do some more testing as it's 90% consistent, just very odd behaviour!

    Mike


    ------------------------------
    Michael Wink
    Willis Towers Watson
    Reigate
    ------------------------------

    Conference-CRMUG_200x200


  • 6.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    TOP CONTRIBUTOR
    Posted Dec 19, 2019 09:09 AM
    Edited by Rex Kenley Tan Dec 19, 2019 09:09 AM
    Micheal

    Try this, create a temporary test form by "save as" and see if the same behavior occurs.

    Sounds like you got some "rogue" code unlocking that field after the formOnLoad. The hard part would then be is to track it down.

    ------------------------------
    Rex Kenley Tan, MCSA, MCSD
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------

    Conference-CRMUG_200x200


  • 7.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    MICROSOFT MVP
    Posted Dec 19, 2019 10:06 AM
    @Michael Wink - Have you tried setting up Field Level Security on this field? You can apply "Read" as the only available option for everyone (except System Admins of course).  ​

    ------------------------------
    Aaron Back
    Microsoft MVP | Sr. Microsoft Dynamics 365 Consultant
    ACE Microtechnology
    _______________________________________
    CRMUG Board Member
    CRMUG Chapter Leader - Cincinnati, Ohio
    ------------------------------

    Conference-CRMUG_200x200


  • 8.  RE: Lock Estimated Revenue Field - Opportunity D365 UI

    Posted Dec 19, 2019 10:15 AM
    That's an interesting idea, good shout, I'll give it a blast

    ------------------------------
    Michael Wink
    Willis Towers Watson
    Reigate
    ------------------------------

    Conference-CRMUG_200x200


If you've found this thread useful, dive deeper into User Group community content by role