+ Start a Discussion
Muhammad Jawwad 16Muhammad Jawwad 16 

How to replace null to "-" after fetching the query result in the sending email template?

User-added image
Khan AnasKhan Anas (Salesforce Developers) 
Hi Muhammad,

Greetings to you!

Please refer to the below link which might help you further with the above requirement.

https://developer.salesforce.com/forums/?id=906F0000000MLRGIA4

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Sarah J DSarah J D
Hi Muhammad,

Before sending the email, do a null check and replace all the null field with a hyphen '-'.

Example:

List<Account> accList = [SELECT Id,Name,DataComs__c FROM Account WHERE Name=:'DELL'];

If my field is Date__c,

1. Null Check: 
for(Account acc:accList)
{
if(acc.DataComs__c==null)
DataComs__c.replace(null,'-');
}