Skip to main content
Prashanthkumar Annarapu が「#Apex」で質問
public class relatedLeadshelper 

{

    public void createLeadrecord()

    {

        Lead ld = new Lead ();

        ld.FirstName='Test';

        ld.LastName='Lead record';

        ld.Company='Microsoft corp';

        ld.Status='Open not connected';

        ld.Industry='Banking';

        ld.AnnualRevenue=45000000;

        ld.Phone='990887766';

        ld.Fax='8899776655';

        ld.Email='sample@gmail.com';

        ld.LeadSource='Web';

        ld.Website='www.salesforce.com';

        ld.city='Hyderabad';

        ld.State='Telangana';

        ld.country='India';

        insert ld;

        //create contact record

        if(ld.id!=null)

            system.debug('Lead record is created with id ..:'+ld.id);

        contact con = New Contact();

         con.FirstName='NAYANATHARA';

                con.LastName='Contact record';

                 con.Title='Sales manager';

                 con.Phone='7780282373';

                 con.Email='Sample@gmail.com';

                 con.HomePhone='99005544433';

                 con.MailingCity='Hyderabad';

                 con.MailingState='Telangana';

                 con.MailingCountry='India';

                con.Leadid=ld.id;

            insert con;

            if(con.id!=null)

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

        }

    }

 Error:

Variable does not exist: Leadid

whats wrong on my code

   

 
1 件の回答
  1. 2022年3月11日 6:02
    Hey,

    Because there is no field exist with API name "Leadid" on the contact object.

    Hence the error.

    Thanks!
0/9000