Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How can I count mber of empty fields in a record?

Asked by Elonjigar Mar 2, 2023 506 views 1 answer
Share

About this question

My question is about challenges when Opportunity is created specific fields must be populated. How can I count the fields which are not null from specific fields?

 integer counter;
 integer oppValue;
    for (Opportunity : Trigger.new) {
        if (myOpp.Amount != null) {
            oppValue= 1;}
        else if {oppValue= 0;}
     // Same loop repeats for several fields assigning value to oppValue. 
    counter = oppValue ++;
    System.debug(counter);

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.