You need to sign in to do that
Don't have an account?
Initializing an sobject with record id
Lets say I have Id of Account record and I am initializing the sobject and assigning the Id to account variable. Below is the code :
****obj : Account:{Id=0019000001dbup5AAA}
I was hoping that the debug will have the entire information from the account example like : Account:{Id=0019000001dbup5AAA, Name=TestAccount,...}
Is there any way to initialize the sobject in a way such that it gets loaded with the entire information?
sObject obj = Schema.getGlobalDescribe().get(parentObjName).newSObject() ; obj.Id = recordId; System.debug('****obj : '+obj);Debug Result:
****obj : Account:{Id=0019000001dbup5AAA}
I was hoping that the debug will have the entire information from the account example like : Account:{Id=0019000001dbup5AAA, Name=TestAccount,...}
Is there any way to initialize the sobject in a way such that it gets loaded with the entire information?
You can try this -
Thanks,
Sumit Kumar Singh
All Answers
Thanks,
Sumit Kumar Singh
Why not just do a SOQL query such as [SELECT Name, Id etc From Account WHERE Id = :recordId];
You can try this -
Thanks,
Sumit Kumar Singh