How to Add and Subtract Number of Days from Date Field in MS CRM 2011

How to Add and Subtract Number of Days from Date Field in MS CRM 2011

function SubDays() {

var date = Xrm.Page.getAttribute(“datefield”).getValue();

date.setDate(date.getDate() -7);

Xrm.Page.getAttribute(“datefield”).setValue(date);

}

function AddDays(){

var startdate = Xrm.Page.getAttribute(“datefield”).getValue();
startdate.setDate(startdate.getDate()+7);
Xrm.Page.getAttribute(“datefield”).setValue(startdate);

}

Happy Coding

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s