I need to display the account name with a slash between account name and the parent account name , if the parent account field is filled. I tried to do that using SObjectType methods. But couldn't do it. I am facing:
Invalid relationship fromo account to account.
Also if I removed getSobject('Account')
I am facing:
null pointer exception.
Here is my code.
if(wrp.mySObject.getSObject('Account').getSObject('Parent').get('Name')!=null){
wrp.mySObject.put('Name',wrp.mySObject.get('Name')+'/'+wrp.mySObject.getSObject('Account').getSObject('Parent').get('Name'));
}
Here wrp is the instance of my wrapper class and mySObject is the SObject variable used in that class. Please just tell me the right way to do it generally. I will implement the same according to my code.