Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
19 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
0answers
26 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
0answers
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
1answer
40 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>> ...
2
votes
1answer
25 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
1answer
80 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
1answer
37 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
1answer
27 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
2answers
11 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
1answer
25 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
0answers
23 views

Conditional Math Equation in Report

I have a Report that includes a calculation for "days overdue" of a Case (Due Date - Closed Date). SFDC is calling this field CDF1. I want to add a calculation for the average days overdue ...
0
votes
1answer
60 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
2answers
61 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
1answer
212 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
0answers
23 views

Validation rule that requires fields to be filled out before change of Opp stage except for particular country

This is the Validation Rule I have created so far, what I need is to include - VAT field on the Account can't be blank except when the Account Country field says USA AND( NOT(ISBLANK( Account....
0
votes
0answers
19 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
1answer
73 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
1answer
17 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
1answer
24 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
2answers
559 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
1answer
18 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
1answer
58 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
2answers
44 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
3answers
511 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
1answer
45 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
0answers
18 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
1answer
39 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
1answer
140 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
1answer
36 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
1answer
29 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
1answer
1k 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
1answer
19 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
2answers
495 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
0answers
25 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
2answers
481 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
1answer
241 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
1answer
794 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
1answer
212 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
1answer
65 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
3answers
821 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/"), ...
0
votes
1answer
72 views

Image formula field render issue

I have a formula that is rendering a static resource based on checkboxes on my Contact record. The issue I am seeing is that when the image loads, it appears super tiny - the static resource is not ...
0
votes
1answer
572 views

Redirect to a url on a click of custom button through if condition

Hey i am trying to redirect on a url on a click of custom button which will create a new quote in which name will be prepopulate as same as parent opportunity name but it is not redirecting on a page....
0
votes
1answer
40 views

'Attempt to de-reference a null object' with Field__c.contains()

When I use contains, I get Attempt to de-reference a null object: for(Gear__c g : gears{ if(toolsMap.get(g.Id).Status__c == 'Off' || toolsMap.get(g.Id).HelpText__c.contains('Hello there!')){ ...
0
votes
1answer
817 views

Conditional custom button on page direct to URL if condition = true, display message if false

I have a custom button on a custom object page from which I generate a VisualForce PDF document (Content Source = URL). There are conditions, however, where the PDF should not be generated based on ...
1
vote
2answers
158 views

IF Statement Ampscript ignores 6th IF statement

I have an email that is in build with a large amount of IF statements contained within the email. The concept of the email is that if the 10 item fields are populated then show all 10 within the body ...
0
votes
1answer
55 views

Syntax error in this IF statement?

I'm having issues with the following IF statement - it's causing the cloudpage it's on to report an internal server error. I'm assuming the issue is a syntax error somewhere, because I can't see ...
0
votes
1answer
4k views

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

I keep getting Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 4 Can anyone advise on where its pulling the 4? IF ( $UserRole.Name = "x", IF( AND (Quantity >...
0
votes
1answer
40 views

multiselect pick list custom field

I have a long if(includes formula that is aggregating a few common responses into the same text values. (It's longer than below but that is enough for my question). There are actually 3 outcomes I ...
0
votes
1answer
28 views

IF(CONTAINS) question from an MPL

I am trying to aggregate data from an MPL into a separate field with fewer values. When I run the formulas, it is only returning the first value. Is there a way to rewrite the formula so that all true ...
0
votes
1answer
44 views

Execution enters IF loop, even if the condition is not satisfied

if(User.FirstName != NULL && User.MiddleName != NULL && User.LastName != NULL) { User usr = [SELECT FirstName,MiddleName,LastName FROM User WHERE ...