AnsweredAssumed Answered

date difference using Java/Groovy script

Question asked by priyankas9531 on Jun 22, 2015
Latest reply on Dec 18, 2016 by 69881137

Hi,
I am trying to calculate data difference of SFDC Date format but i am getting error doing so. Below is the script that i am using.

 

import java.util.Properties;
import com.boomi.execution.ExecutionUtil;
import groovy.time.*;

propName1 = "DPP_Opportunity_ID";
propName2 = "DPP_Flag";
propName3 = "DPP_Creation_Date";

getOpportunityID = ExecutionUtil.getDynamicProcessProperty(propName1);
getFlag = ExecutionUtil.getDynamicProcessProperty(propName2);
getCreationDate = ExecutionUtil.getDynamicProcessProperty(propName3);

if (getOpportunityID != OppntyID)
{
    if (ApprovalDate != null)
      {
         TimeDuration duration = TimeDuration.minus(ApprovalDate, CreatedDate)
         //System.out.println("days: ${duration.days}, Hours: ${duration.hours}")
         ExecutionUtil.setDynamicProcessProperty (propName2,"N",true);
         ExecutionUtil.setDynamicProcessProperty (propName1,OppntyID,true);   
      }
    else
       {        
         ExecutionUtil.setDynamicProcessProperty (propName2,"Y",true);
         ExecutionUtil.setDynamicProcessProperty (propName3,CreatedDate,true);
         ExecutionUtil.setDynamicProcessProperty (propName1,OppntyID,true);
       }
  }
else
{
     if (ApprovalDate != null)
      {
if (getFlag == Y)
      {
         TimeDuration duration = TimeDuration.minus(ApprovalDate, CreatedDate)
                //System.out.println("days: ${duration.days}, Hours: ${duration.hours}")
             ExecutionUtil.setDynamicProcessProperty (propName2,"N",true);
          }
               else  
                   {
             TimeDuration duration = TimeDuration.minus(ApprovalDate, CreatedDate)
            //System.out.println("days: ${duration.days}, Hours: ${duration.hours}")
           ExecutionUtil.setDynamicProcessProperty (propName2,"N",true);
                  }
      }
      else
       {
        if (getFlag == N) {
              ExecutionUtil.setDynamicProcessProperty (propName2,"Y",true);
              ExecutionUtil.setDynamicProcessProperty (propName3,CreatedDate,true);
              }
             else
             {
             String Filter = "Yes"
             }

     }
}
0EM40000000bqX7

Outcomes