Skip to main content
Prashanthkumar Annarapu が「#Apex」で質問
apex class code:

public class relatedAccountshelper 

{

    public static void createdaccountrecord()

    {

          Account acc = new Account();

        acc.name='Veeramallu';

        acc.Rating='Hot';

        acc.Industry='Chemicals';

        acc.Phone='7780282373';

        acc.Fax='77802823';

        acc.Website='infosys.com';

        acc.Active__c='Yes';

        acc.BillingCity='Hyderabad';

        acc.BillingState='Telangana';

        acc.BillingCountry='India';

        acc.CustomerPriority__c='High';

        insert acc;

        //created the related contact record

        if(acc.id!=null)

        {

            system.debug('account record id is..:'+acc.id);

            contact con=new contact

                con.Firstname='Sample';

                con.LastName='Contactrecord';

                con.Title='Salesmanager';

                con.Phone='9900667788';

                con.MailingCity='Hyderabad';

                con.MailingStreet='Telangana';

                con.MailingCountry='India';

            con.AccountId=acc.id;

            insert con;

            if(con.id!=null)

                system.debug('contact record is created with id..:'+con.id);

            

                

        }

        

    }

}

it shows error like 

Unexpected token 'con.Firstname'.

 
1 件の回答
  1. 2022年3月10日 17:28
        contact con=new contact  replace this line in your code with  

        contact con=new contact();
0/9000