Questions tagged [if]
The if tag has no usage guidance.
107
questions
-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,
...
-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'?
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 ...
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,...
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 "...
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','...
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 <&...
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 ...
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 ...
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 ...
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 ...
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 {
...
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....
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 ...
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(...
-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>> ...
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 ...
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&...
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 ...
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, ...
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(
(...
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 ...
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....
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();...
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 ...
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, ...
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 ...
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 ...
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....
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 ...
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&...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
-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. ...
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="...
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 ...
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 - ...
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, ...
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 ...
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 = ...
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
...
-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 ...
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 (...
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 ...
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/"), ...