You need to sign in to do that
Don't have an account?
Jyosi jyosi
Call out (@Future) when the status is changed on contact
Hello Everyone,
I am making a callout to external webservices ,I am not getting any error ,
Here is my problem ,When i update values on contact that wont value are not passing to external webservices.
Its passing the random records.
Below is my trigger code and apex Class
trigger Rephistorytracking on contact (after update,before update) {
RepTriggerHandlerclass contactHandler = new RepTriggerHandlerclass ();
Jcoreutil JcoreHandler= new Jcoreutil();
if(Trigger.isAfter && Trigger.isUpdate) {
contactHandler.onAfterUpdate(Trigger.New, Trigger.oldMap);
}
if(Trigger.IsAfter && Trigger.isUpdate)
{
contactHandler.onAftercontactUpdate(Trigger.New);
}
if(Trigger.IsUpdate && Trigger.isBefore)
{
Jcoreutil.JcoreAdd();
}
}
###################APEX CLASS####################################
public class Jcoreutil {
@future(callout=true)
public static void JcoreAdd()
{
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 LicenseNumber;
for( contact TerminateCntQuery :[Select Id,Name,CRD__c,FirstName,LastName,Middle_name__c,Gender__c,Address_Type__c,
MailingStreet,MailingCity,MailingState,MailingPostalCode,Email,MobilePhone,
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,Birthdate,Rep_Status__c,
QCC_DSP__c,Term_Date__c,Start_Date__c,LastModifiedDate,HomePhone,Phone,OtherPhone
from Contact where (Rep_Status__c='Terminated'OR Rep_Status__c='Converted') Limit 1])
{
system.debug('TerminateQuery@@@@'+TerminateCntQuery);
if(TerminateCntQuery.Rep_Status__c=='Converted')
{
TerminateCntList.add(TerminateCntQuery);
TerminateCntId.add(TerminateCntQuery.id);
List<License__c> lstLicensesValues=new List<License__c>();
License__c LicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId Limit 1] ;
lstLicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId];
integer LicensesValue;
LicensesValue=lstLicensesValues.size();
Please help me
I Tried to pass the list of ids,but its give error while calling method in trigger.
Thanks.
Regards,
Jyo
I am making a callout to external webservices ,I am not getting any error ,
Here is my problem ,When i update values on contact that wont value are not passing to external webservices.
Its passing the random records.
Below is my trigger code and apex Class
trigger Rephistorytracking on contact (after update,before update) {
RepTriggerHandlerclass contactHandler = new RepTriggerHandlerclass ();
Jcoreutil JcoreHandler= new Jcoreutil();
if(Trigger.isAfter && Trigger.isUpdate) {
contactHandler.onAfterUpdate(Trigger.New, Trigger.oldMap);
}
if(Trigger.IsAfter && Trigger.isUpdate)
{
contactHandler.onAftercontactUpdate(Trigger.New);
}
if(Trigger.IsUpdate && Trigger.isBefore)
{
Jcoreutil.JcoreAdd();
}
}
###################APEX CLASS####################################
public class Jcoreutil {
@future(callout=true)
public static void JcoreAdd()
{
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 LicenseNumber;
for( contact TerminateCntQuery :[Select Id,Name,CRD__c,FirstName,LastName,Middle_name__c,Gender__c,Address_Type__c,
MailingStreet,MailingCity,MailingState,MailingPostalCode,Email,MobilePhone,
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,Birthdate,Rep_Status__c,
QCC_DSP__c,Term_Date__c,Start_Date__c,LastModifiedDate,HomePhone,Phone,OtherPhone
from Contact where (Rep_Status__c='Terminated'OR Rep_Status__c='Converted') Limit 1])
{
system.debug('TerminateQuery@@@@'+TerminateCntQuery);
if(TerminateCntQuery.Rep_Status__c=='Converted')
{
TerminateCntList.add(TerminateCntQuery);
TerminateCntId.add(TerminateCntQuery.id);
List<License__c> lstLicensesValues=new List<License__c>();
License__c LicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId Limit 1] ;
lstLicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId];
integer LicensesValue;
LicensesValue=lstLicensesValues.size();
Please help me
I Tried to pass the list of ids,but its give error while calling method in trigger.
Thanks.
Regards,
Jyo
Use the formal parameter of the callout method as Set<Id> like below
Thank you
Choose it as best answer if it has helped you
All Answers
Method structure ---- JcoreAdd(List<Id> ids)
Use the formal parameter of the callout method as Set<Id> like below
Thank you
Choose it as best answer if it has helped you