-
How can I cover the code coverage for multiple conditions in IF statement in Salesforce?
Below is the code for class:
public class ControllerHelper
{
public static boolean validate (Case obj)
{
if((obj.field1 = 'Yes' || obj.field2 = 'Yes') && checkNullValue(obj.field3))
||
((obj.field4 = 'Yes' || obj.field5 = 'Yes') && checkNullValue(obj.field6))
)
return true;
else
{
return false;
}
}public static boolean checkNullValue(String value)
{
if(value==null || value.trim().length()==0)
{
return true;
}
return false;
}
}
Log In to reply.
Popular Salesforce Blogs
Migrating to Salesforce: Key Steps for a Seamless Transition
Migrating to Salesforce can transform how your business operates. Whether you're looking to streamline your sales process, improve customer service, or better analyze your data,…
What is External ID in Salesforce - The Definitive Guide
In this blog, we will discuss the External ID in Salesforce. So, An External ID is a custom field that has the External ID attribute,…
Salesforce Marketing Cloud Datorama: Bring Your Data into Play
Datorama solves marketing data challenges, being one of the features of Salesforce Marketing Cloud. Looking for an in-depth overview of Salesforce Marketing Cloud and its…
Popular Salesforce Videos
Secrets and Tips on Marketing Automation in Marketing Cloud | Marketing Cloud Webinar by Vimera
Hi there! Welcome to the recording of our Marketing Cloud Webinar from September 30, 2024! At Vimera (vimera.io), we’re proud to be a trusted Certified…
Dreamforce 2020 FAQs | Dreamforce To You | Salesforce Event
As the COVID-19 situation continues to evolve, questions around virtual Dreamforce 2020 continue to increase and that's why we've gone ahead and answered all the…
Data Cleansing in Salesforce and Salsa - Why it matters?
Research by Blackbaud found that 67% of data available to some nonprofits were un-mailable. That is either a lost opportunity or wasted money. This especially…