Given scenario: Follow Up Date must be greater or equal to today.
The most easiest way to achieve the requirement is by Javascript; let see how it works
every time user change the field, onchange event on CRM fire the javascript to verify the input.
<br /> function FollowUpDate() <br /> { <br /> var current=new Date(crmForm.all.createdon.DataValue); <br /> var days=-1; //To handle crmForm onCreate or onChange <br /> if(crmForm.all.createdon.DataValue==null) <br /> { <br /> d=new Date(); <br /> current.setFullYear(d.getYear(),d.getMonth(),d.getDate()); <br /> days=0; <br /> } <br /> <br /> var selected=new Date (crmForm.all.followupby.DataValue); <br /> <br /> var ONE_DAY=1000*60*60*24; <br /> var different=selected-current; <br /> var indicator=Math.round(different/ONE_DAY); <br /> <br /> if(indicator<days){ alert("Backdated disallowed for 'Follow Up By'."); crmForm.all.followupby.DataValue=null; } }
Hope this simple javascript can help :)
0 comments :
Post a Comment