web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
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

I have the same question (0)
  • Verified answer
    Jeet Gandhi Profile Picture
    320 on at

    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

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • Community Member Profile Picture
    on at

    Hi Goutam

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

  • Community Member Profile Picture
    on at

    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

    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

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans