Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Calculated fields

(0) ShareShare
ReportReport
Posted on by

Hi,

My requirement is i have two calculated fields one is" StartDte "another one is "EndDate"  when i given EndDate is 7/19/2018 to 7/30/2017 need to change the startDate will be 07/01/2018  automatically how to approach this one please help out.

Thanks,

Naresh

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Calculated fields

    sorry for mistake..

    "StartDate" field is empty  and "EndDate" would be 7-20-208 need to populate the "StartDate" will be 7-01-2018 please help me

  • Community Member Profile Picture
    on at
    RE: Calculated fields

    Hi Gautam,

    same requirement the "StartDate" field is empty  and "EndDate" would be 20-20-2020 need to populate the "StartDate" will be 01-20-2020 please help me.

  • Community Member Profile Picture
    on at
    RE: Calculated fields

    Hi Goutam

    Thank you for your help!  it is perfectly working..

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Calculated fields

    Hi Naresh,

    I would prefer for this kind of logic implement Javascript code. Register the method on change of end date field.

    function CheckDateComparetoOtherField() {

               var endDateVal = Xrm.Page.getAttribute("new_EndDate").getValue() ;// Replace Field name

               var endDateObjValue = new Date(endDateVal);

               var endDateValue = endDateObjValue.getFullYear() + '/' + (endDateObjValue.getMonth() + 1) + '/' + endDateObjValue.getDate();

    var startDateValue =null;

    If(endDateObjValue.getDate() > 19)

    {

     startDateValue = endDateObjValue.getFullYear() + '/' + (endDateObjValue.getMonth() + 1) + '/' + "1";

    var startDateObjValue = new Date(startDateValue);

               Xrm.Page.getAttribute("new_StartDate").setValue(startDateObjValue); // Replace Field name

    }

    else

    {

    // write logic if you have any

    }

    }

    Hope this helps.

  • Verified answer
    Jeet Gandhi Profile Picture
    320 on at
    RE: Calculated fields

    Hello,

    My requirement understanding - When the EndDate is like  07/19/2018 =< EndDate <=07/30/2018, update StartDate as 07/01/2018 (Hardcode value)

    If the above understanding is correct, then please know it is not possible to achieve the same using calculated fields.

    As per my suggestion, it's better to use OOB workflow in this case. Trigger the workflow on the update of EndDate and put conditions like if

    EndDate>= 07/19/2018 AND EndDate<= 07/30/2018

    If the above condition is satisfied, update the StartDate as 07/01/2018 (Hardcode value)

    Hope the above solutions will be helpful to you.

    Please mark it as answer if found useful.

    Thank you

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans