Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

JavaScript doesnt apply when saving

$
0
0

I used some javascript to set a date and it works when a new form is opened but when the form is saved it allows the user to change the date to earlier than the set date by the JavaScript.

Is there something that I have to add to the JavaScript to make sure this field cannot be changed once the form has been saved?

function SetDate()

{

   if(Xrm.Page.ui.getFormType() == 1)

   {

       var dueDate = Xrm.Page.data.entity.attributes.get("new_date"); // Field used is Date on XXX Form

       var now = new Date();

       var endDate = new Date().setDate(now.getDate()+3); // Set Date to Today + 3 Days

       dueDate.setValue(endDate);

   }

}

Thanks!


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>