You need to sign in to do that
Don't have an account?
sushanth s 2
How to match two different object fields for getting the record details?
Hi all,
Could anyone help me to matching the field with two different objects
1.I Have two objects 1.Case 2.custom object Integration__c.here i'm tring to get
the matching the some fields of both objects.
2.Case object fields for matching AccountName and IntegrationTo__c and Integration__c object fields are account__c,integrationwith__c.
3.if the both object fields are matching then get the record details from Integration__c custom object.
for that i have developed a trigger as after insert on Case object.
trigger IntegrationType on Case (after Insert) {
List<ID> cIds = new List<ID>(); //List<Integration__c> integ = new List<Integration__c>();
for(Case cObj : Trigger.new){
if(cObj.Account.Name != null && cObj.IntegrationTo__c != null){
cIds.add(cObj.Id); //add case ids.
}
}
List<Integration__c> ll = [SELECT id,name,username__c,password__c,URL__c,account__c,integrationwith__c FROM Integration__c WHERE Id=:cIds];
for(Integration__c lst : ll){
if(!cIds.isEmpty()){
//help me here how to match the fields
String uname = lst.username__c;
String pwd= lst.password__c;
String url= lst.URL__c;
System.debug('Username :' +uname);
System.debug('Username :' +pwd);
System.debug('Username :' +url);
}
}
}
Could anyone help me to matching the field with two different objects
1.I Have two objects 1.Case 2.custom object Integration__c.here i'm tring to get
the matching the some fields of both objects.
2.Case object fields for matching AccountName and IntegrationTo__c and Integration__c object fields are account__c,integrationwith__c.
3.if the both object fields are matching then get the record details from Integration__c custom object.
for that i have developed a trigger as after insert on Case object.
trigger IntegrationType on Case (after Insert) {
List<ID> cIds = new List<ID>(); //List<Integration__c> integ = new List<Integration__c>();
for(Case cObj : Trigger.new){
if(cObj.Account.Name != null && cObj.IntegrationTo__c != null){
cIds.add(cObj.Id); //add case ids.
}
}
List<Integration__c> ll = [SELECT id,name,username__c,password__c,URL__c,account__c,integrationwith__c FROM Integration__c WHERE Id=:cIds];
for(Integration__c lst : ll){
if(!cIds.isEmpty()){
//help me here how to match the fields
String uname = lst.username__c;
String pwd= lst.password__c;
String url= lst.URL__c;
System.debug('Username :' +uname);
System.debug('Username :' +pwd);
System.debug('Username :' +url);
}
}
}
I would assume that Integration__c object has a lookup field relating to Case (Case__c).
You can filter the list based on SOQL query and that will be easy to achieve like this: Hope this helps.
Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others.
Regards,
Nagendra.
You have to just add two more filter condition uing the and operand in your SOQL queryand then u can that list data in your further logic
Thanks
Pranav