function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hiteshkumar Chaudhari 2Hiteshkumar Chaudhari 2 

typecast object of type type account to another custom object

Hello guys,

I want to type cast the account record to another custome object how to do this in apex.?
sfdcMonkey.comsfdcMonkey.com
hi HiteshKumar
go to below link for dynamically typecast an sObject to custom object in Apex
http://www.oyecode.com/2013/05/dynamictypecastingvisualforce.html
I hope it helps you
let me inform if it helps you
 
Suraj Tripathi 47Suraj Tripathi 47
Hi HiteshKumar,

Greetings!

You can typecast Account object to sObject type.
Use this code-
Account acc = new Account();
sObject sObj = new sObject();
sObj = (sObject)acc;
System.debug(sObj);
If you find your Solution then mark this as the best answer. 

Thank you!
Regards,
Suraj Tripathi