You need to sign in to do that
Don't have an account?
Jyosi jyosi
@future method to use Trigger.Old and Trigger.New
Hello Everyone,
I need to compare the Trigger.Old and Trigger.new Values in Apex Callout
My code goes here
if(Trigger.IsUpdate && Trigger.isBefore)
{
Jcoreutil.JcoreAdd(trigger.newMap.keyset());
contactHandler.onQCCSupervisor(Trigger.New);
}
public static void JcoreAdd(Set<Id> contactIdSet)
{
//if(!WorkFkowvalidatorclass.hasAlreadyDone()){
Set<Id> TerminateCntId= new Set<Id>();
Set<Id> RepIdsValue= new Set<Id>();
List<Id> CntListIds= new List<Id>();
List<contact> TerminateCntList= new List<contact>();
String RepHireDate;
Datetime HireDate;
Datetime Birthdate;
String BithdateRep;
String MobileNumber1;
String MobileNumber;
String HomeNumber1;
String HomeNumber;
Datetime QAMDSPStartDate;
Datetime QAMDSPEndDate;
String QAMDSPStartDateConversion;
String QAMDSPEndDateConversion;
Datetime QCCDSPStartDate;
Datetime QCCDSPEndDate;
String QCCDSPStartDateConversion;
List<Contact> contactUpdate= new List<Contact>();
String prospectRecType = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('Rep').getRecordTypeId();
List<Contact> LstCntQuery=[Select Id,Name,CRD__c,FirstName,LastName,Middle_name__c,Gender__c,Address_Type__c,
MailingStreet,MailingCity,MailingState,MailingPostalCode,Email,MobilePhone,Alt_Email__c,
QAM_DSP__r.Name,QAM_DSP__r.CRD__C,QCC_DSP__r.CRD__C,QAM_DSP__r.FirstName,
QAM_DSP__r.LastName,QCC_DSP__r.FirstName,QCC_DSP__r.LastName,QCC_DSP__r.Start_Date__c,QCC_DSP__r.Term_Date__c,
OtherCity,OtherPostalCode,OtherState,OtherStreet ,Birthdate,Rep_Status__c,QAM_DSP__r.Start_Date__c,QAM_DSP__r.Term_Date__c,
QCC_DSP__c,RecordTypeId ,QAM_DSP_End_Date__c,QCC_DSP_Start_Date__c,QAM_DSP_Start_Date__c,Salutation,Term_Date__c,Start_Date__c,Jcore_Status__c,LastModifiedDate,HomePhone,Phone,OtherPhone
from Contact where Id IN:contactIdSet];
I need to compare the fields QAM_DSP__r.CRD__C
Here is breif why i am going for that
before update i am trying to update this value in another system.
I have Rep tied to a Manager
First call out takes the Manager Name,Start date and Insert the values.
after few days the Manager changes that time the Second Manager start date should be equal to FirsrManger End Date .
So i thought to compare the new an old values
based on new and old values i need to control to populate the End Date Accordingly.
Please help me out.
Regards,
Jyo
I need to compare the Trigger.Old and Trigger.new Values in Apex Callout
My code goes here
if(Trigger.IsUpdate && Trigger.isBefore)
{
Jcoreutil.JcoreAdd(trigger.newMap.keyset());
contactHandler.onQCCSupervisor(Trigger.New);
}
public static void JcoreAdd(Set<Id> contactIdSet)
{
//if(!WorkFkowvalidatorclass.hasAlreadyDone()){
Set<Id> TerminateCntId= new Set<Id>();
Set<Id> RepIdsValue= new Set<Id>();
List<Id> CntListIds= new List<Id>();
List<contact> TerminateCntList= new List<contact>();
String RepHireDate;
Datetime HireDate;
Datetime Birthdate;
String BithdateRep;
String MobileNumber1;
String MobileNumber;
String HomeNumber1;
String HomeNumber;
Datetime QAMDSPStartDate;
Datetime QAMDSPEndDate;
String QAMDSPStartDateConversion;
String QAMDSPEndDateConversion;
Datetime QCCDSPStartDate;
Datetime QCCDSPEndDate;
String QCCDSPStartDateConversion;
List<Contact> contactUpdate= new List<Contact>();
String prospectRecType = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('Rep').getRecordTypeId();
List<Contact> LstCntQuery=[Select Id,Name,CRD__c,FirstName,LastName,Middle_name__c,Gender__c,Address_Type__c,
MailingStreet,MailingCity,MailingState,MailingPostalCode,Email,MobilePhone,Alt_Email__c,
QAM_DSP__r.Name,QAM_DSP__r.CRD__C,QCC_DSP__r.CRD__C,QAM_DSP__r.FirstName,
QAM_DSP__r.LastName,QCC_DSP__r.FirstName,QCC_DSP__r.LastName,QCC_DSP__r.Start_Date__c,QCC_DSP__r.Term_Date__c,
OtherCity,OtherPostalCode,OtherState,OtherStreet ,Birthdate,Rep_Status__c,QAM_DSP__r.Start_Date__c,QAM_DSP__r.Term_Date__c,
QCC_DSP__c,RecordTypeId ,QAM_DSP_End_Date__c,QCC_DSP_Start_Date__c,QAM_DSP_Start_Date__c,Salutation,Term_Date__c,Start_Date__c,Jcore_Status__c,LastModifiedDate,HomePhone,Phone,OtherPhone
from Contact where Id IN:contactIdSet];
I need to compare the fields QAM_DSP__r.CRD__C
Here is breif why i am going for that
before update i am trying to update this value in another system.
I have Rep tied to a Manager
First call out takes the Manager Name,Start date and Insert the values.
after few days the Manager changes that time the Second Manager start date should be equal to FirsrManger End Date .
So i thought to compare the new an old values
based on new and old values i need to control to populate the End Date Accordingly.
Please help me out.
Regards,
Jyo
See:
Future Annotation (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htm" target="_blank)
Primitive Data Types (https://www.salesforce.com/developer/docs/api/Content/primitive_data_types.htm" target="_blank)