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
tpettytpetty 

Help with Apex code

Can someone please assist with the code below....What I am trying to achieve is to set the default date of a record to the 'Order Hand off date + 5 if the Industry code is not equal to '010 Waste Water' OR 020 Fish & if the Industry code is equal is equal to these categories to add 40 days onto the 'Order Hand off date'

IF(engProject.T_C_Review_Required__c == 'Yes' && (
        engProject.Industry_Code__c != '010 Waste Water' ||
        engProject.Industry_Code__c != '020 Fish')){
       
                    dueDate = ProjectActivityHelper.addBusinessDays(engProject.Order_Hand_off_Date__c,5);
                    projActivity = ProjectActivityHelper.buildProjectActivity(engProject.ID, dueDate,
                    'Order Processing', 'Approve T&C', engProject.OwnerID);
                    projectActivityList.add(projActivity);
              }
             
       IF(engProject.T_C_Review_Required__c == 'Yes' && (
        engProject.Industry_Code__c == '010 Waste Water' ||
        engProject.Industry_Code__c == '020 Fish')){
       
                    dueDate = ProjectActivityHelper.addBusinessDays(engProject.Order_Hand_off_Date__c,40);
                    projActivity = ProjectActivityHelper.buildProjectActivity(engProject.ID, dueDate,
                    'Order Processing', 'Approve T&C', engProject.OwnerID);
                    projectActivityList.add(projActivity);
              }
Vinit_KumarVinit_Kumar
You should be using addDays method to add any number of days to the current value something like below :-
// creating a new instance of Date method
date myDate = 
     date.newInstance(1960, 2, 17);
// adding 2 days to it
date newDate = mydate.addDays(2);

If this helps,please mark it as best answer to help others :)