web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

lock and unlock the date and time data type

(0) ShareShare
ReportReport
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 

I have the same question (0)
  • Suggested answer
    Charan Raju C R Profile Picture
    7 Moderator 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);
    }

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

    Thank You.

  • Verified answer
    Charan Raju C R Profile Picture
    7 Moderator 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
    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.

  • Suggested answer
    Charan Raju C R Profile Picture
    7 Moderator 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/.../

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 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans