Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

lock and unlock the date and time data type

Posted on by 10

Hello EveryOne,

my question is consider a two fields arrival date and departure date these fields are date and time  data type , by default departure field is lock when insert a date on arrival field then departure field has to unlock.i Need a java script 

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Super User 2024 Season 1 on at
    RE: lock and unlock the date and time data type

    Please go through below links to create Business Rules and register javascript function on form events.

    docs.microsoft.com/.../create-business-rules-recommendations-apply-logic-form

    reenhanced.com/.../

  • ONENEXT Profile Picture
    ONENEXT 10 on at
    RE: lock and unlock the date and time data type

    Answer is help full but , i am beginner to this little confusion how to implement can you help.

  • Verified answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Super User 2024 Season 1 on at
    RE: lock and unlock the date and time data type

    Please mark the post as answered if it has helped to resolve your problem.

  • ONENEXT Profile Picture
    ONENEXT 10 on at
    RE: lock and unlock the date and time data type

    Thank You.

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 3,155 Super User 2024 Season 1 on at
    RE: lock and unlock the date and time data type

    Hi ONENEXT,

    You can use Business Rule to achieve this requirement as in the below screenshot.

    BusinessRule1.PNG

    If you still need javascript, below is the function which unlocks Departure Date when the Arrival Date is inserted. You can register this function on change of Arrival Date field and on form load. Also, lock the Departure Date field by default under form field properties.

    function unlockDepartureDate() {
        var arrivalDate = Xrm.Page.getAttribute("arrivalDateFieldName").getValue();
        Xrm.Page.getControl("dipartureDateFieldName").setDisabled(arrivalDate == null);
    }

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans