function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ChrisparxChrisparx 

problem with HasSchedule... so easy but what is wrong ??

Hello,

 

My problem is really simple: Trigger.new[X].HasSchedule (or old) seems not to be working. 

 

I explain more in details. I have a schedule under an Opportunity Product. By clicking on a button, I generate this schedule and also I copy some data to another tab. This step runs without any problem. But when I wish to delete the schedule (I click on "delete") and as the interaction with the schedule is limited, I had the idea to write a trigger (in order to delete the previously datas copied to the other tab) because I could simply detect if my opportunity product has still the schedule with Trigger.new[X].HasSchedule. It looks simple... The problem is that the result of Trigger.new[X].HasSchedule is always 'false'. I tested "HasSchedule" under a sql request under eclipse and it's working exactly as intended (result "true" if there is a schedule and false if not...).

 

Well I tried during a few hours lots of things as "Trigger.old", I separated the test with a "Trigger.isAfter" then a "Trigger.isBefore", but no way, the result is always 'false'. I tried lots of other similar things, nothing work..

 

Has someone already been confronted with this problem or has an idea where the problem could come ?

 

Best Answer chosen by Admin (Salesforce Developers) 
ChrisparxChrisparx
ok i found a workaround. hasschedule used with the trigger seems to be bugged, but making a select on the table is working as in eclipse so my problem is fixed