I have a field called description which tracks all the changes made to "Add to Description" field.
When the description field is blank and any new value is entered into Add to Description field, I can also see "null" value in the description field.
Below is my code snippet:
if (String.isEmpty(newCaseIssue.Add_To_Description__c)) {} else {
newCaseIssue.Description__c = newCaseIssue.Description__c + '\n\n' + strUserName + ' Date/Time of Addition: ' + DateTime.now().format() + '\n' + newCaseIssue.Add_To_Description__c;
newCaseIssue.Add_To_Description__c = '';
}
Can anyone please suggest the changes to the above code so that I can exclude the null term from description on first update of the record.