Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Make fields required 24 hrs after create

  • 1.  Make fields required 24 hrs after create

    SILVER CONTRIBUTOR
    Posted 18 days ago
    Help, please! I need to make a few Opportunity fields required 24 hours after Opportunity Create date (not during initial Opportunity creation).
    What is the best/simplest approach to do that?

    Thank you!

    ------------------------------
    Kristina Bjerknes
    REDW
    ------------------------------


  • 2.  RE: Make fields required 24 hrs after create

    Posted 18 days ago

    Try a business rule with a hoursdiff between created on and  Now()

     






  • 3.  RE: Make fields required 24 hrs after create

    MICROSOFT MVP
    Posted 18 days ago
    Hi Kristina,

    In my view, the simplest way to set the fields as required would be to use JavaScript in the form onload event to check the record creation date against today's date.

    I appreciate that this will require coding skills so may not be ideal.  There may be a way to achieve what you want with business rules but to my knowledge, you can't get today's date/time with a business rule. There are likely to be ways to achieve what you want without code (like calculated fields with a business rule) but in my opinion, they would be more convoluted and less easy to maintain.

    Rather than setting fields as required after a certain time, have you considered making them mandatory in the business process flow at a certain point instead? This would be a more typical approach.  It could be achieved without code (using BPF branching or business rules) and prevent a user from going to the next stage in the BPF before the fields are completed.  Here's an example of using conditions in BPFs: https://www.inogic.com/blog/2017/08/make-the-business-process-flow-fields-to-be-required-conditionally/

    Best regards,
    Andrew.

    ------------------------------
    Andrew Bibby
    Dynamics 365 Consultant & Project Advisor
    Evesham, United Kingdom
    ------------------------------



  • 4.  RE: Make fields required 24 hrs after create

    GOLD CONTRIBUTOR
    Posted 17 days ago
    It seems that JavaScript or using BPFs is indeed your best bet.

    In this thread 3 options are discussed on how to set a field to today's date:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/190532/date-field-with-today-s-date

    1. Create a calculated field that you set to Now() - drawback: you can't use calculated fields in business rules - there's a messy workaround for this as well - by creating a second field into which you "copy" today's date from the first field using a workflow. This solves the trigger problem in the second option:
    2. Create a workflow that sets the field to the execution date - drawback: with traditional workflows you cannot build recurring workflows and need to find a reasonable trigger for when to update the field - running the workflow daily could potentially achieved if you were using Flow though
    3. using JavaScript - drawback: you need to code

    We have also set fields to required based on stages and it works well for us. If you are trying to enforce service levels then SLAs might be something for you to look into https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customer-service/define-service-level-agreements

    ------------------------------
    Sissy Bottcher
    Business Process Innovation Specialist
    StudyPortals
    San Diego CA
    ------------------------------



  • 5.  RE: Make fields required 24 hrs after create

    Posted 17 days ago
    Edited by Nikhil Rajendran 17 days ago
    Hi Kristina,
    The best thing would be for you to do it through JavaScript.Advantage of Javascript is you can trigger it in multiple ways.

    ------------------------------
    Nikhil Rajendran
    Aha Apps
    Glen Allen VA
    ------------------------------



  • 6.  RE: Make fields required 24 hrs after create

    D365UG/CRMUG ALL STAR
    Posted 16 days ago
    Hi Kristina,

    I don't see the need to write Javascript on this one.

    I would leverage a Business Rule in addition to a workflow...the workflow can be enhanced to even send a notification out to the user to let them know the fields are now required, if needed.

    ------------------------------
    Gus Gonzalez
    8x Microsoft MVP, CRMUG All-Star
    CEO, Elev8 Solutions
    ------------------------------



  • 7.  RE: Make fields required 24 hrs after create

    SILVER CONTRIBUTOR
    Posted 16 days ago
    Thank you, all!! Good recommendations!
    I am not able to do coding unfortunately, and also we do not use Business Process Flow anymore, so those two options are not really viable at this time.

    What would be best approach to take tackling this with a Workflow and/or business rules?

    Thank you!

    ------------------------------
    Kristina Bjerknes
    REDW
    ------------------------------



  • 8.  RE: Make fields required 24 hrs after create

    D365UG/CRMUG ALL STAR
    Posted 16 days ago
    Hi Krsitina,

    Unfortunately I'm going to make you wait until Tuesday for the solution because I think this is valuable to show on our Two-Minute Tuesday series. The video is on the queue for Tuesday at 9 AM ET.

    Subscribe to the channel so you don't miss it!

    https://www.youtube.com/c/crmmvpmedia

    ------------------------------
    Gus Gonzalez
    8x Microsoft MVP, CRMUG All-Star
    CEO, Elev8 Solutions
    ------------------------------



  • 9.  RE: Make fields required 24 hrs after create

    GOLD CONTRIBUTOR
    Posted 15 days ago
    I find that manipulating required fields is best done in Business Rules, particularly if coding is not an option. I do not believe Workflows are capable of setting required fields, and I am quite sure that Flow is not. Using an embedded PowerApps is probably an option, but adding a business rule is the easiest and quickest way, in my opinion. It could look something like this:


    ------------------------------
    Audrey Forrest
    Senior Accountant and Business Analyst
    Seattle WA
    CRMUG Co-Chapter Leader - Seattle
    D365 CRM V9, GP 2015 R2
    ------------------------------



  • 10.  RE: Make fields required 24 hrs after create

    D365UG/CRMUG ALL STAR
    Posted 15 days ago

    Hi Audrey,

    The problem with business rules is that there is no way to do a timeout.

    The condition you show on your screenshot is actually impossible to satisfy, because the Created On date never changes.

    So saying that Created On equals Created On plus 1 doesn't really do anything.

    Now if we could only use "Today" then that would be perfect and your answer would work because you would do a condition like "If Today is Created on+1" and then that would work just fine.

    There is no possible way to do this via Business Rules alone...it needs to use a workflow/flow for the timeout.

    More on Tuesday at 9 AM EST. :)



    ------------------------------
    Gus Gonzalez
    8x Microsoft MVP, CRMUG All-Star
    CEO, Elev8 Solutions
    ------------------------------



  • 11.  RE: Make fields required 24 hrs after create

    GOLD CONTRIBUTOR
    Posted 15 days ago
    @Gus Gonzalez Of course, you are totally correct. However, Workflow does have a timeout functionality, so you could set the workflow to run every time an Opportunity is created and then set some field to TRUE after 24 hours. Then, the business rule could look to see if that field is True and then set the field(s) as required. ​

    ------------------------------
    Audrey Forrest
    Senior Accountant and Business Analyst
    Seattle WA
    CRMUG Co-Chapter Leader - Seattle
    D365 CRM V9, GP 2015 R2
    ------------------------------



  • 12.  RE: Make fields required 24 hrs after create

    D365UG/CRMUG ALL STAR
    Posted 15 days ago


    ------------------------------
    Gus Gonzalez
    8x Microsoft MVP, CRMUG All-Star
    CEO, Elev8 Solutions
    ------------------------------



  • 13.  RE: Make fields required 24 hrs after create

    SILVER CONTRIBUTOR
    Posted 15 days ago
    Thank you, all, for willing to share best practices!

    ------------------------------
    Kristina Bjerknes
    REDW
    ------------------------------



  • 14.  RE: Make fields required 24 hrs after create

    D365UG/CRMUG ALL STAR
    Posted 11 days ago

    And here it is!



    ------------------------------
    Gus Gonzalez
    8x Microsoft MVP, CRMUG All-Star
    CEO, Elev8 Solutions
    ------------------------------



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