You need to sign in to do that
Don't have an account?
learn_sfdc
How to get custom object in to apex class
Hello Friends,
I am trying to retrive a data from Custom Object A to Standard Object B
for standard object i can use if function like below
if(MoreCase.Account.Type != null && MoreCase.Account.Type != '')
{
if(MoreCase.Account.Type.contains('Customer')){
ShowCustomer = true;
}else if(MoreCase.Account.Type.Contains('Ex-Customer')){
ShowExCustomer = true;
I am using Account object and type is field which standard object but for my custom object and field how would i use
custom object API Name - Product_Version_Master__c
field name is - Existing_Version
how will i use this in my function?
Thanks
I am trying to retrive a data from Custom Object A to Standard Object B
for standard object i can use if function like below
if(MoreCase.Account.Type != null && MoreCase.Account.Type != '')
{
if(MoreCase.Account.Type.contains('Customer')){
ShowCustomer = true;
}else if(MoreCase.Account.Type.Contains('Ex-Customer')){
ShowExCustomer = true;
I am using Account object and type is field which standard object but for my custom object and field how would i use
custom object API Name - Product_Version_Master__c
field name is - Existing_Version
how will i use this in my function?
Thanks
Shruthi,
Use this query as below : -
MoreCase = [Select c.Product_Version_Master__r.Existing_Version
from Case c where Id= :ViewingCase.Id];
if(MoreCase.Account.Type != null && MoreCase.Account.Type != '')
{
if(MoreCase.Product_Version_Master__r.Existing_Version.contains('Customer')){
ShowCustomer = true;
}else if(MoreCase.Product_Version_Master__r.Existing_Version.Contains('Ex-Customer')){
ShowExCustomer = true;
Note : - I am assuming, Custom object "Product_Version_Master__c" is parent and Case is child.
on Case, API Name of lookup field is "Product_Version_Master__c"
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
All Answers
Hi Shruti,
What the MoreCase represent ?
Thanks
MoreCase = [Select c.Account.Special_Support__c,
c.Account.Type,
from Case c where Id= :ViewingCase.Id];
querying...
Shruthi,
Use this query as below : -
MoreCase = [Select c.Product_Version_Master__r.Existing_Version
from Case c where Id= :ViewingCase.Id];
if(MoreCase.Account.Type != null && MoreCase.Account.Type != '')
{
if(MoreCase.Product_Version_Master__r.Existing_Version.contains('Customer')){
ShowCustomer = true;
}else if(MoreCase.Product_Version_Master__r.Existing_Version.Contains('Ex-Customer')){
ShowExCustomer = true;
Note : - I am assuming, Custom object "Product_Version_Master__c" is parent and Case is child.
on Case, API Name of lookup field is "Product_Version_Master__c"
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
Please replace if(MoreCase.Account.Type != null && MoreCase.Account.Type != '')
by if(MoreCase.Product_Version_Master__r.Existing_Version!= null && MoreCase.Product_Version_Master__r.Existing_Version!= '')
Thanks
Rajat
i sent a mail to you, can you please check.
Thanks