• Daley Huang
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
LastName and Company fields no nulls allowed, but I not want to overwrite if the recode is existing when upsert data, how to handle it?

list<Lead> objLead = new List<Lead>();
for (Integer i = 0; i < OpenIDList.size(); i++)
        {
            objLead.add(
                New Lead(
                    LastName = 'LName',
                    company = 'Company A',
                    OpenID__c = '000001',
                  )
            );

        }

        try {
            upsert objLead OpenID__c;
        } catch (DmlException e) {

        }