Activity Forums Salesforce® Discussions How to convert Schema.SObjectField into String in Salesforce?

  • Aditya

    Member
    October 21, 2020 at 12:57 pm

    Account a = [SELECT Name FROM Account WHERE Name = 'Foo' LIMIT 1];String s = a.Name;// I can save it, but when I run the application I get another error.
    // try --> String s =(String) a.Name;
    String c = Account.Name;//second option I get the error "Illegal assignment from Schema.SObjectField to String".
    // try --> String c = (String)Account.Name;

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos