You need to sign in to do that
Don't have an account?
![Agnibha Chakrabarti 10 Agnibha Chakrabarti 10](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
how to get value of one field from list of SObject
in my code
11:55:42:011 VARIABLE_ASSIGNMENT [11]|this.c|[{"Student__c":"a022v00001GmqnrAAB","Batch__c":"a042v00002CobkCAAR","Id":"a052v00000l4WxtAAE","Student__r":{"Id":"a022v00001GmqnrAAB"}},{"Student__c":"a022v00001GnNHiAAN","Batch__c":"a042v00002CobkCAAR","Id":"a052v00000l4c5dAAA","Student__r":{"Id":"a022v00001GnNHiAAN"}}]
I want to get only Student__r id field values.
how to get that?
List<Student_Batch_Junction__c > c=new List<Student_Batch_Junction__c>([select Student__r.id from Student_Batch_Junction__c where Batch__r.Name in :b]);variable c contains:
11:55:42:011 VARIABLE_ASSIGNMENT [11]|this.c|[{"Student__c":"a022v00001GmqnrAAB","Batch__c":"a042v00002CobkCAAR","Id":"a052v00000l4WxtAAE","Student__r":{"Id":"a022v00001GmqnrAAB"}},{"Student__c":"a022v00001GnNHiAAN","Batch__c":"a042v00002CobkCAAR","Id":"a052v00000l4c5dAAA","Student__r":{"Id":"a022v00001GnNHiAAN"}}]
I want to get only Student__r id field values.
how to get that?
Please check below code:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
All Answers
sObject acc = [SELECT Owner.Profile.Name FROM Account LIMIT 1]; String profileName = (String) acc.getSobject('tellsubway (https://tellsubway.world/)').getSobject('Profile').get('Name'); System.debug(profileName);
i think you will get your student id field value.
Please check below code:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com