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
anyioneta1.3025054394678596E12anyioneta1.3025054394678596E12 

ObjectToString

How do I convert Objects to String.
e.g.
Object ChildFieldValue = ChildRecord.get('FirstName);
string s = ChildFieldValue1 .toString();


Error: Compile Error: Illegal assignment from Object to String at line 51 column 17


Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

try this

Object ChildFieldValue = ChildRecord.get('FirstName);
string s;
if(ChildFieldValue1 != null)
{
 s = String.valueOf(ChildFieldValue1);
}

 This should solve the issue