You need to sign in to do that
Don't have an account?
Daley Huang
How to avoid overwrite specific fields when upsert recode?
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) {
}
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) {
}
For example : -
if(!(ObjName.fieldName != null && String.isNotBlank(String.valueOf(ObjName.fieldName))){
//assign the values here
}