Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
20 views

IF Formula help - Multiple Parameters Issue

Im new to salesforce formulas and need to implement this new field (New_License_Manager_ID__c) into the formula. I received an Error: Incorrect number of parameters for function 'IF()'. Expected 3, ...
user avatar
-1 votes
1 answer
24 views

IF Ampscript - if a record from one data extension exists in another

Is there a way to write an IF ampscript to say: If records from Data extension A, exist in Data extension B, then display 'Welcome Back' ELSE display 'welcome'?
user avatar
1 vote
1 answer
39 views

problem with switch case

I share with you my code which appears to work well the problem I have is that: If for example, I choose the status as closed and I choose dates, I can't save and that's what I want, but when I try to ...
user avatar
0 votes
1 answer
52 views

Test class data missing?

I have a couple of days with this test class. I added already all data necessary for my test class, but I'm getting only 69%. The problem is on the all "if", when I test my test class Its ok,...
user avatar
0 votes
1 answer
37 views

formula field condition

I want to express this condition with my new formula type field that returns text Green Flag: is still valid Orange Flag: 1 year approaching its end. Red Flag: no longer valid so exceeds the "...
user avatar
0 votes
1 answer
43 views

Formula problem with Multiple Condition

I need help please, I created two fields, the first is "Group" of text type and the second is "status" of formula type The status must check the condition of If Group contains '9','...
user avatar
0 votes
1 answer
59 views

Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

The title says it all. I know I am missing my 3rd parameter per the error, but I can't determine where. IF ( Not_Final_Destination__c = TRUE, IF (AND(SCMC__Customer_Account__r.ShippingCountry <&...
user avatar
1 vote
2 answers
38 views

When the if condition is true it still prints else condition statement

Hope guys are doing well. I'm a newb and still learning javascript. My if condition isn't working, I created a simple if-else loop (if any condition is met it should print following conditions ...
user avatar
0 votes
1 answer
71 views

Alternatives for multiple If statements

I need to compare the fields and depending on that if its true then update a boolean variable and if its false then capture this field and get the label and append it to a string. I have like 10-12 ...
user avatar
0 votes
1 answer
26 views

Render code if condition is true

I want to render the span syntax only if the wrapper.AccHead is not empty. I tried the code below, but it does'nt work. I tried also to use the rendered syntax in span but it does' nt work. Is there a ...
user avatar
  • 83
0 votes
1 answer
517 views

Adding conditional logic (IF, THEN) in Salesforce HTML email templates

I'm struggling with adding IF, THEN conidition to my HTML Classic Email template and hoping someone can help. I am trying to say if Cohort Owner's name is 'X', then post the X link, if Cohort Owner's ...
user avatar
0 votes
2 answers
61 views

Aura Redirect Component Only if CustomerID is not Null

I wrote code for an Aura Redirect Component but I'm having trouble getting it to redirect only if the CustomerId is not null. Here's my code. Apex Controller public with sharing class NetsuiteQuote { ...
user avatar
0 votes
1 answer
24 views

Why this set does not contain my data?

I have this data: Account.Zone__c = 'A'; Zone_set = '{ B, A, C}'; if(!Zone_set.contains(Account.Zone__c)) { //do this } Account.Zone__c = 'B'; Zone_set = '{ B, A, C}'; if(!Zone_set.contains(Account....
user avatar
  • 157
0 votes
0 answers
62 views

I want to create a Text String in a Parent Object of Multiple Products sold on a specific Opportunity using a Formula Field - Help?

Parent Object - Opportunity Child Object - Opportunity Product I have a field for each product on the Opportunity. For example if Opportunity Products X and Y were added to the Opportunity as ...
user avatar
  • 29
0 votes
0 answers
20 views

How to get code coverage for independent if conditions in for loop using test class in salesforce? [duplicate]

I need help to get 100% code coverage for below trigger.This trigger will prevent me creating duplicate record. trigger DuplicateTriggerReseller on Reseller_Details__c (before insert) { for(...
user avatar
  • 1
-2 votes
1 answer
175 views

HOW TO Avoid three or more nested LOOPS [duplicate]

for(String objectName : jsonMap.keySet()){ // List<map<String,String>> listObjects=jsonMap.get(objectName); List<Map <String, String>> ...
user avatar
  • 1
3 votes
1 answer
856 views

Changing the colours of the fields depending on a formula?

I have two number fields on opportunity layout. A and B. I want to create a formula field and when A>B the formula field will be red or just an indication that people will notice it right away when ...
user avatar
  • 45
0 votes
1 answer
1k views

IF ISBLANK FORMULA

I'm trying to get a validation rule to check a Date Field called Triage_Stop_Time and if there is a value in the field it will make my Billing Picklist required with an error message "Required&...
user avatar
  • 3
0 votes
1 answer
47 views

Formula field with 4 IF statements and 2 False statements

I need to make a formula field work, unfortunately, I cannot figure out how to place statements so that I can include 2 False options (False options have been bolded) The logic behind the formula: If ...
user avatar
  • 29
0 votes
1 answer
127 views

Help with nested IF statement with images

I have a field "Account__r.Commission_Rate__c" and depending on the value of this % field, I want to show a coloured flag. If the % is 0-5, the red flag needs to display. If the % if 5-10, ...
user avatar
0 votes
2 answers
12 views

Advance formula field nested condition not working

I want a formula like this: IF ( (Field1 = 'Value1' AND Field2 = 'Value2') OR ( NOT (ISBLANK (Field3))) ), "Output1", "Output2") This is my actual formula: IF( (...
user avatar
  • 97
0 votes
1 answer
55 views

Expression cannot be assigned: when trying to use multiple if statements in a for loop

There is an object tm__c which contains LinkedIn URl(URL field),two picklist fields: Backgroundcheck(Yes, NO) and Verification(Pending, Not started, Done) I want to create a batch class so that I have ...
user avatar
  • 3
0 votes
1 answer
121 views

how to concatenate lookup fields given certain circumstances

I finished up this batch but came across an unforeseen scenario and can't seem to figure out how to code in the case it occurs. Here is my current code: global class Batch implements Database....
user avatar
0 votes
2 answers
73 views

How to check object name by objectId?

trigger CreateTask on ContentVersion (after insert) { List<Task> insertTask = new List<Task>(); Task newTask = new Task(); Schema.DescribeSObjectResult k=Contact.sObjectType.getDescribe();...
user avatar
0 votes
1 answer
857 views

Nested IF AND formula: Error when encoding row-level formula: Syntax error. Extra ','

I'm trying to create a row-level formula to calculate the following: I have a custom object called 'Car Transaction', with the following fields: 'Sign Up Fee' and 'Success Fee' Here is what I want the ...
user avatar
0 votes
0 answers
28 views

NULL IF Statement is making a linebreak

I have a section on our Opportunity that creates a Text formula based on if a box in column A is ticked and the same box in column B is not. For example, if we request Item 1, we tick the first box, ...
user avatar
0 votes
1 answer
296 views

Empty String check not working

I am developing an Apex class which is making a webservice callout by supplying Account number as the request payload. If the Account is not found in the external system, the webservice is returning a ...
user avatar
0 votes
1 answer
19 views

Error saving formula - IF statement needs revision

I need to simplify my code, due to the IF formula being too long. This formula is being used in a visualforce page that populates a pagesection based on user input choices. Can someone help me with ...
user avatar
1 vote
1 answer
29 views

IF AND OR together in one formula

I want to write a formula for the following: Return Value A IF: Intake__c.Personal_Care__c contains 'toileting/bathing' OR Intake__c.Safety__c contains 'entering or exiting' AND Intake__c....
user avatar
0 votes
2 answers
2k views

Unexpected token error in If statement in LWC Javascript controller

This is a basic javascript question. FYI the context is: It is in a Javascript controller for a Salesforce Lightning Web Component, editing in Visual Studio. The code is for selecting a set of table ...
user avatar
  • 322
1 vote
1 answer
23 views

Am I just missing a parenthesis somewhere?

IF( ISPICKVAL(FPLHW_Brands__c,"NEH"), IF( RecordType.Name <> "NEH Realtor Enrollment", IF( whw_Renewal__c = False, "a2b29000000yBA7AAM","a2b29000000yBhmAAE&...
user avatar
  • 11
0 votes
1 answer
85 views

Else if part getting skipped Salesforce Apex

I wrote this class with a method that sends an email from Sendgrid based on each template id. It works fine except, I have an if else statement which only runs the if and else part and not the else if....
user avatar
  • 1
0 votes
2 answers
195 views

Conditional display of style

I was trying to display style conditionally based on an attribute. In the below example I am trying to display first 2 elements in the list in blue color and the other 2 elements in green color. When ...
user avatar
  • 169
0 votes
3 answers
2k views

Null check condition for User object SOQL query

Below is the query I have used :- User singleUser= [SELECT id,name,alias FROM user WHERE alias = 'random' AND name = 'Random Name' LIMIT 1]; In the IF condition I want to check for the null ...
user avatar
0 votes
1 answer
107 views

Custom Button URL using IF condition found on Salesforce doc but not working

I am trying to create a custom button redirecting either to : the correct LinkedIn profile if the LinkedIn ID is filled a LinkedIn search using First Name & Last Name So far, here is what I have ...
user avatar
  • 1
0 votes
0 answers
36 views

Formula IF with territory field / salesforce lightning

Good afternoon, I want to display "East", if territories are: New England Northeast Mid-Atlantic Southeast Midwest Hearthland I want to display "West", if territories aren't these ...
user avatar
  • 1
0 votes
1 answer
61 views

Question related to Process builder field update based on conditions

I am working on a scenario where we have a custom object which has standard Name field and an Autonumber field and 3 record types. I am trying to update the Name field based on the record type as ...
user avatar
  • 169
1 vote
1 answer
274 views

Using IsPickVal() function inside Email Templates

I tried using the following ISPICKVAL formula within an email template as shown: MQP Type is a pick list on the Task Object. I have run integration code(Python under AWS) which sets the pick list ...
user avatar
-1 votes
1 answer
53 views

string.isempty doesn't appear to work when trying to retrieve price list Name

it appears my if statement with String.isEmpty doesn't seem to be working. What i want it to do is check if a price list entry doesn't exist it creates a new one, and if it does it updates that one. ...
user avatar
0 votes
1 answer
67 views

formula field with lots of nested Ifs and Ands - confusion

having a little trouble following the necessary logic to get this formula field syntax correct. i need to accomplish the following: If source_system__c="Adobe" AND If type__c="...
user avatar
  • 3
1 vote
1 answer
2k views

LWC conditional display on load of component not working

Based on the field values of the Account, I want to display/hide parts of the component when it loads for the first time. I have tried so many things unsuccessfully and am hoping someone can help me ...
user avatar
  • 1,387
0 votes
1 answer
22 views

Control going inside 'If' block even when it should not (only for 1 value)

I am trying to count the number of weekdays (Monday - Friday) by taking the number of days since 01-07-1900 (7th January, 1900), for a given date, and checking the modulus by 7. For modulus values 0 - ...
user avatar
1 vote
2 answers
1k views

Apex Unit Test for if == null and return statements

I have a simple helper method in my Apex Code that loads an external ID from a field on the related Case.Contact. I have problems to write a proper unit test that covers the last three lines, ...
user avatar
  • 179
0 votes
0 answers
34 views

Never left if condition

I've got a tricky question, my code doesn't work - suprise. I would like to return only a list of 'filtred' data but my code never leav a if condition. So when if condition return true and my script ...
user avatar
  • 35
2 votes
2 answers
2k views

Help with Formula field IF

I am creating a Formula field that returns texts when: Picklist_Status = Activated, the return text should be A else null Picklist_Status = Sold, the return should be B else null Picklist_Status = ...
user avatar
  • 33
0 votes
1 answer
4k views

Creating a formula field using IF statement with Text return [duplicate]

I am creating a Formula field that returns texts when: 1Picklist_Status = Activated, the return text should be A else null 2Picklist_Status = Sold, the return should be B else null ...
user avatar
  • 1
-2 votes
1 answer
2k views

If condition for Values in Map<string,List<string>in apex

I have below snapshot where i just wanted to check if map is having the value 20 in it or not. How i can write if condition for list of string values map<string,List<string>> getmap=new ...
user avatar
3 votes
1 answer
266 views

An error occurred while checking the query syntax. Errors: Old style JOIN (ANSI JOINs) syntax is not allowed. Please use standard syntax

I've had a few different kinds of query return the following error message, quite often when I'm using 'case when': "An error occurred while checking the query syntax. Errors: Old style JOIN (...
user avatar
2 votes
1 answer
83 views

IF and AND statements within Visualforce page

I'm a Visualforce newbie so forgive me if my question comes across as a bit ignorant... I'm trying to render a Visualforce page based on specific conditions. I got it to work with one condition but ...
user avatar
  • 31
0 votes
3 answers
2k views

What happens with an IF formula with multiple TRUE conditions?

I have a multi nested IF statement like below - what happens if a field meets more than one condition - is there a rule to determine which value gets returned? IF(CONTAINS( Custom__Name__c , "/cs/"), ...
user avatar
  • 1,268