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 CRM (Archived)

Populating the Effective Date

(0) ShareShare
ReportReport
Posted on by

Hello Everyone:

Can someone assist me in auto populating the Effective From and To dates on a quote. I would like that when I Create or save a Quote that it automatically puts in today's date for Effective from and then calculates 60 days to populate into the Effective To.

There was a post similar to this and they had this script and I placed it into the Quote form Properties but it did not work. Do I need to set some Parameters or use the Non-event Dependencies.

function SetDueDateField()
{
        var dateFieldValue= Xrm.Page.getAttribute('effectivefrom').getValue();
	var year = dateFieldValue.getFullYear();
	var month = dateFieldValue.getMonth();
	var day = dateFieldValue.getDate();
	var dateOnly = new Date(year,month,day)+60;
	Xrm.Page.getAttribute("effectiveto").setValue(dateOnly); 	
}

Any help would be great

Note I'm not a programmer


*This post is locked for comments

I have the same question (0)
  • Mahendar Pal Profile Picture
    45,095 on at
    RE: Populating the Effective Date

    You can simply use business rule for this:

    ENDDATE.png

  • awalters Profile Picture
    3,079 on at
    RE: Populating the Effective Date

    The business rule adds the 60 from start, but can a business rule do the other half - fill in today's date for start?

  • Mahendar Pal Profile Picture
    45,095 on at
    RE: Populating the Effective Date

    Hi,

    There is not direct formula to get current date, but as the requirement is to set effective date as current date, so Created On can be copied to Start, by selecting Field option under Set Default value action.

    createdon.png

    Thanks

  • awalters Profile Picture
    3,079 on at
    RE: Populating the Effective Date

    Clever workaround - that hadn't occurred to me.  Thanks!

  • Community Member Profile Picture
    on at
    RE: Populating the Effective Date

    I made changes that Guido recommend, but it still not working.

    I do not have anything in function within the Parameters or Non-Event Dependencies

    0880.Capture.PNG

    Do I need an event Handler?

    If so what is it.

  • Mahendar Pal Profile Picture
    45,095 on at
    RE: Populating the Effective Date

    Surly you need to call your method to some event like on OnChange of the effective To or OnSave of the form, so add event handler for your first field or for form OnSave

    Thanks

  • Community Member Profile Picture
    on at
    RE: Populating the Effective Date

    A little lost on this, is there a link for this or can you please explain a little more about this.

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Populating the Effective Date

    Hi,

    Follow below steps:

    1. Open Form Editor and double click on first date field to open it's properties.

    2. Click on Event Tab->Click on Add->Select your web resource (new_EffectiveDate i think) under library drop down

    onchange.png

    3. Past your function name under Function for example SetDueDateField (make sure without ()  )

    4. Save and publish your changes

    Now as soon as you will set your first date it should populate second date field base on the above logic.

    Let us know if you need more information.

    Thanks

  • Community Member Profile Picture
    on at
    RE: Populating the Effective Date

    Still having problems.

    This is what I have done.

    In the Quote Form I click on Form Properties and add this info

    6825.Capture.PNG

    I then double clicked on Effective From and added this info

    6825.Capture.PNG

    1538.Capture1.PNG

    Saved it and Published.

    Any help would be awesome

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans