Skip to main content
Christos Kolonis (Metlen) 님이 #Apex에 질문했습니다
Hello, 

I need to compare two date fields, the End Date of an event created inside an Opportunity and the today date. Based on the outcome, i will update an Opportunity Stage.

I tried this unsuccessfully:

 

Event eve = [select id, subject, whatId, EndDate from Event where whatId =: newOpp.id];

date d = eve.EndDate;

system.debug(d);

date e = system.today();

system.debug(e);

boolean dates = d.isSameDay(e);

system.debug('Dates: ' + dates);

if(newOpp.RecordTypeId == recordTypeServices && dates == false && newOpp.StageName == 'Proposal'){

newOpp.addError('The appointment with the customer must be completed');

}

That is not working. Am i missing something?

Thank you!
답변 2개
  1. 2020년 11월 16일 오후 6:03
    Hi Christos,

    I see that you have put multiple debug statements in the code while running have you checked where the code is failing? let us know the issue you are facing to check further.

    Looking forward to your response.

    Thanks.
0/9000