Questions tagged [if]
The if tag has no usage guidance.
132
questions
0
votes
0
answers
20
views
Row level formula: Pull value between two dates
I am trying to make a row level formula to identify dates that are in Q1 (Sep, Oct, Nov) of two years of fiscal data. I am able to distinguish between FY23 and FY24 using
IF(Case.End_Date__c > DATE(...
-2
votes
2
answers
32
views
Add a "0" to the left of the postal code
I would like to put a formula in a flow to update the postal code if it only contains 4 characters.
All my postcodes must be 5 characters long so I would like to add a 0 to all the postcodes that are ...
0
votes
1
answer
36
views
Nested IF CONTAINS AND Formula - results not returning correct answers - What am i doing wrong?
I am looking to return the values to an Expected Revenue column, based on the WEB FORM CAMPAIGN field having specific words in. The campaign names are set up like the following, so I am looking for ...
0
votes
1
answer
42
views
How to test two conditions in formula field IF
So I'm stuck on the logic here this was my original code and it worked but I was also trying to add a condition that if TODAY()-LLC_BI__Covenant2__c.LLC_BI__Next_Evaluation_Date__c) > 0 is true ...
0
votes
1
answer
36
views
issue with UpsertDE "Unable to retrieve security descriptor for this frame"
I'm trying to write results in a Data Extension but this is the message response in the cloud page
{"message":"Unable to retrieve security descriptor for this frame.","...
0
votes
2
answers
379
views
lwc:if and lwc:else directive not working
child cmp html
<template>
<!--Edit Mode-->
<template lwc:if={_isEditable}>
<input type="number" step="1"></input>
<button>
{...
0
votes
1
answer
172
views
Using ampscript check if value exists in data extension
I have a customer_data_extension that consists of customers with their customer_id.
I'm creating an email with conditional content, so IF customer exists in customer_data_extension then show this ...
-1
votes
1
answer
267
views
Formula field to evaluate two fields separately and returns a value based on one or the other values
The formulas work separately but I need the formula to evaluate the formulas in a "or" situation. IF I use & for the first formula - it concatenates the field but I want a Closed Or an ...
0
votes
2
answers
41
views
Struggling with syntax errors on and IF AND statement
I seem to always be struggling with resolving syntax errors on my IF code. I have used VS editor so it's easier to read and I don't think it's a parenthisis issue. Getting the error message "The ...
0
votes
1
answer
178
views
Multiple IF AND ELSE statements
I am trying to create a formula with several specific requirements to calculate call contact rates.
The first IF section of my formula works on its own, however adding the additional IF statements ...
-1
votes
1
answer
60
views
CASE or IF - how to create a formula field with several IF?
Im a bit confused in creation formula to calculate field Source on Case. the task is :
On Case create formula to calculate the following:
For users with country US show Account Source if Account ...
0
votes
2
answers
362
views
AmpScript redirect not working in if/else
Hello I'm working on a Cloud Page in Marketing Cloud. I'm trying to set a redirect based on the result of an object update in a connected CRM.
Example code below.
%%[
var @campaginMemberId, @city, ...
0
votes
1
answer
79
views
Incorrect IF formula : expected 3, received 4
I need to add some lines into a formula and I started it but I'm stopped with the following issue : Incorrect number of parameters for function 'IF()'. Expected 3, received 4. I saw there's another ...
0
votes
1
answer
44
views
If / then to set an Id - Invalid id
The below code is an attempt to push some child objects my code creates into a master opportunity.
Not all Opportunities will be children, hence I want to do a check.
TargetOpid is the variable I want ...
0
votes
2
answers
458
views
Checkbox formula not working
I am trying to select a checkbox if, "Connected" is in the disposition and the call sentiment field does not have "Gatekeeper".
My formula isn't working:
IF(
AND(
CONTAINS(...
1
vote
1
answer
52
views
Only showing those that Return true from a FOR AmpScript
I am searching a data extension based on an ID and returning vairables and a link from those.
I was able to get it to pull all the required data and show correctly. However when I try to add a ...
0
votes
3
answers
573
views
Multiple If Statements for a merge field for a HTML Email Template
I am trying to create a conditional formula for a merge field for a HTML Email Template with the following logic;
IF both ICMS ID and Portal ID are present then only show ICMS ID
OR
IF only ICMS ID is ...
0
votes
2
answers
680
views
render child component div in lwc by matching data-attributes on button click
I have a component that displays a list of questions using a for:each. For each question rendered I have a child component (which is a simple form with a few fields) to capture a followup question.
I ...
-2
votes
1
answer
83
views
Formula on contact to see if the first name is only 1 character long [closed]
We currently have a formula text field with the below formula:
IF( FirstName =".", text(Salutation) &" "& LastName , FirstName )
but we want to add that if the first name ...
0
votes
1
answer
88
views
IF Statement not closed error
I'm getting an error with an IF statement, even though it was working previously.
This is my code:
Hello %%[IF Empty(@firstname) THEN]%%homeowner, %%[ELSE]%% %%=ProperCase(@firstname)=%%,%% [ENDIF]%%
...
-2
votes
1
answer
135
views
Multiple OR for one variable and with AND CONDITION [closed]
How to write this code
If @br != 'X' OR 'Y' OR 'Z' AND @PROF=='N'
1
vote
1
answer
237
views
Insert or update campaign member after if condition
I'm trying to check if a campaign member has already been entered in a campaign in case affemative update the status otherwise enter the member.
This is my code, but currently it doesn't work very ...
1
vote
2
answers
2k
views
What is the best way to replace the if true condition in LWC
I know that we can't write a specific condition in <template if:true={specificcondition}> LWC HTML file.
However what is the best way to implement next HTML code :
<template for:each={...
-1
votes
1
answer
519
views
Get a value from a string with If condition
I am trying to obtain a value from a string if something is true in the string, example:
I have the following String
String str1 = "{\n\"test1\": \"132456789\",\n\"...
0
votes
1
answer
3k
views
Need help using IF statement in Salesforce Flows
We're moving to Flows and I need a bit of help on IF statements in Salesforce. I've tried a few variations but with the IF statement when creating a DATE formula but I keep getting “Syntax error. ...
0
votes
1
answer
225
views
Formula within a flow - loads of 2 part IF statements - must be a better way of doing this
I'm new here but the questions and answers here have helped me before so thought I'd try posting.
I'm trying to use a boolean formula that will be referenced in a flow. The idea is to update a ...
-1
votes
1
answer
285
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
474
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
771
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
191
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
489
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
2k
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
508
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
2k
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
532
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
115
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 ...
1
vote
1
answer
10k
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
181
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
36
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
202
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
761
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
4k
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
4k
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
68
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
309
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
29
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
239
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
286
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
1k
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();...