« first day (6 days earlier)      last day (28 days later) » 

08:59
Hi @Eric
 
2 hours later…
Hi, who is this?
Hello
How are you Mahmood,
Yeah Im good.
I have asked a query about the skipping Weekends for saturday and sunday with the help of trigger code
Now i have done with the help of you
oh yes.
Great.
10:57
But one small thing I have not able to complete
For Holiday custom object
inserting holiday dates i want to skip the dates
you told to use map and contains key like that
You need to have a map of holidays
can you do some modifications on my code
Mahmood
for holiday only
and from that map check if the input date is occurring between them.
I might, but there is even better solution.
For weekends it is working
please modify my code
Ask this question on SFSE and someone might propose even better solution than what I have proposed.
10:59
trigger ignoreweekends on order (before insert,before update) {
for (order so : Trigger.new) {
list<account> cd =[select id,JDE_Date_Delivery_Offset__c from account where id =:so.accountid];

for(account et : cd)
{
for(integer i=0;i<=et.JDE_Date_Delivery_Offset__c;i++)
{
Datetime dt = DateTime.newInstance(Date.today() +et.JDE_Date_Delivery_Offset__c.longvalue(), Time.newInstance(0, 0, 0, 0));
String dayOfWeek=dt.format('EEEE');
if(dayOfWeek == 'saturday' || dayOfWeek == 'sunday')
{
et.JDE_Date_Delivery_Offset__c = et.JDE_Date_Delivery_Offset__c+ 1;
No your idea is correct
@cloudcomputinginsalesforce: I won't be able to help you right away.
That's why I am suggesting to put this question on sfse
just tell map only
and as you know there are no of users who would be happy to help you right away.
11:00
ok @Mahmood
Map<id.key> value what i have to give?
I guess Map<date, holiday>
since you would need to check the date.
ok
yes
this is the last one i am struggling
best of luck.
ok Thank you @Mahmood
no prob
 
2 hours later…
12:36
@Mahmood Guide me in stack exchange for bulkify the code
Hi, I have added my answer kindly check that.

« first day (6 days earlier)      last day (28 days later) »