Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 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
53 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
26 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
43 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
141 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
52 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
37 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
26 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
115 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
35 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
271 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
89 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
45 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
147 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
33 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
24 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
37 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 ...
0
votes
3answers
47 views

IF Formula on Opportunity Date

I'm sure this is ridiculously simple. I'm trying to put Opportunities into groups based on Age This is the formula I've written IF(Opportunity_Age__c < 100, "Short Term", IF( OR( ...
0
votes
0answers
25 views

If condition in HTML email template not working. Weird

I have a HTML email template with IF loop which is not working. {!IF(NOT(ISNULL(pba__Closing__c.Buildings_survey_booked_To__c)),' to '+pba__Closing__c.Buildings_survey_booked_To__c,' ')} There is ...
2
votes
4answers
3k views

Multiple OR (||) Conditions in If Statement

Can anyone explain why the following If statement does not work with multiple OR conditions. The goal is when this trigger runs, if the user's Id who is updating the record is not equal to a specific ...
1
vote
1answer
29 views

How can I type two If Condition?

I have two promocodes, one is for X Bank and the another one Y Bank, I have just one DE with X Bank Subscribers and Y Bank Subscribers. I want to create one function that shows Promocode X Bank to the ...
-1
votes
1answer
16 views

Visualforce email template IF condition for Second Opportunity Owner field

I have an email alert that goes out when an Opportunity is changed to Closed Won and it says who the Opportunity Owner is. Sometimes, a second salesperson is involved in the deal, so I have a field ...
5
votes
1answer
11k views

Using arithmetic comparison in if:true statement in Lightning web component [duplicate]

I came to a situation where I want to render a text based on there index value. So, Let's assume I am having a loop which is having an index variable and I want to show some specific text if the index ...
1
vote
1answer
48 views

If/else Statement not evaluating issues

I have something weird going on with my code. I have a Data Extension name “DEXT Seeds”. I am checking the DataSourceName_ to see if this list is picked by a user. I have an if/else statement that ...
2
votes
1answer
60 views

Using multiple criteria for IF/THEN function

I am trying to display relevant content to users of a certain type (pro or commercial), but I do have some users that are marked as both. in that case i am using another field (customer type) to ...
0
votes
1answer
57 views

Populate HTML only if data in a field exists

I have a custom object that I am trying to display using visualforce. Some of the fields in the custom object may not have data. I want to check this and only if the data exists, then print the html ...
1
vote
1answer
53 views

Is there a way a more efficient way to write the IF statement

Is the there a more efficient way to write the below IF statement so I only need 2 lines of code or can this be solved with a ternary operator ? if(postIds.size()>0) { PostProperty(...
0
votes
1answer
69 views

Why does the trigger always read my if statement as null? [duplicate]

See the code below from an APEX trigger. For some reason, my trigger always reads nextRenewalDate (field from Account object) as null, regardless of whether or not it is blank. Racking my brain here ...
1
vote
1answer
93 views

Nested Parentheses in an If condition

I'm refactoring legacy code and I'm having a challenging time unraveling the order in which these conditions are evaluated. I'm assuming the two most nested conditions take precedence but I haven't ...
0
votes
2answers
128 views

Error saving formula field because IF statement is too long

I'm trying to create a formula field that will tell me the region which a country is part of. Problem is that there are too many. The code below is just for European Union and Europe and I'm already ...
0
votes
2answers
690 views

Unique Random String Generator in APEX- SOLVED

What needs to be added (an SOQL query perhaps) in the 'else if' statement which checks the value within the c.Name column and tells if the generated random string already exists, and if so add break/...
0
votes
1answer
37 views

How to reassign an object to the user with Role 'X'?

We have a few users with Role 'X'. We need to reassign an object to one from these users, if it's created not by one of them. But my loop choose the last one and change owner even if owner is already ...
0
votes
1answer
34 views

Someone please help me compress this formula - Compiled formula exceeds 5000

Someone please help me compress this formula - Compiled formula exceeds 5000 IF(Today()<Date(Year(Today()),7,1), Case((Year(Pledge_Submitted_Date__c)+YearsToGo__c) -Year(Today()), 4, ...
1
vote
1answer
26 views

If Formula to populate Website between 1 of 2 fields

Trying to populate the Website field on the Account if it's blank. Using an IF formula within a workflow to populate when ISBLANK(Website). The WFR is working for the first field, which is Core ...
0
votes
1answer
894 views

How to write a trigger handler with trigger new [closed]

I am having some trouble to translate my trigger to a trigger handler how do I deal with the for(Invoice__c record:Trigger.new) part? Trigger: trigger UpdateAutoNumber on Invoice__c (before insert) ...
0
votes
1answer
952 views

How to compare dates lightning component

I currently have the following comparison in a Lightning Component: <aura:iteration items="{!v.opleidingenList}" var="opleiding"> <aura:if isTrue="{opleiding.Createddate__c >= v....
1
vote
2answers
62 views

Help with JavaScript Button with If Statement

I know next to nothing about javascript so don't beat me up too much if this is utter garbage, but here is my attempt at a somewhat simple button that looks at 2 values and kicks a flow off or ...
9
votes
2answers
2k views

Best Practice discussion: Difference between SWITCH and IF/ELSE-IF/ELSE? [closed]

NOTE: This is not an opinion-based question. Developers often debate the best way to code ways to do the same thing. Please don't close this as opinion-based. It's a good reference for people choosing ...
0
votes
2answers
600 views

IF condition inside an email template

I am trying to add an IF condition inside an email template but it doesn't work and the condition is not correctly render on Preview. So here is my tests : {{#JsonVarRoom1}} <br /> ...
-1
votes
1answer
2k views

If Condition for validation rule to check two fields

there are two custom fields which are Total fee and invoiced fee, for job object i need add validation rule so that Invoiced fee always less than total fee, user cannot able issue invoice greater than ...
1
vote
1answer
226 views

NullPointerException: Attempt to de-reference a null object in a batchclass

I have this batchclass with which I want to update some checkboxes on account with the values of related assets checkbox values. When running the class I get an System.NullPointerException: Attempt to ...
0
votes
1answer
15 views

Formula field needs to determine where today is in an opportunity's period of performance (PoP)

Not worrying about leap years, I need an if/case statement for: if (today() < start_date__c+364), then PoP_location__c='Base year' if ((today() >= start_date__c+365) and (today() < ...
0
votes
0answers
354 views

Detecting Data Changes with Change Handlers

I am looking at this example in the Developer Guide, and I can't replicate this in my instance. What am I doing wrong? Here is a snippet. <!-- Lookup Attributes --> <aura:attribute name="...
0
votes
1answer
1k views

IF statement with AND statement: If date field is NULL and today's date is 5 days before due date

I'm not getting any errors but I'm not getting the results that I'm looking for. The field is empty if the proposal date is empty and if today's date is 5 days before the proposal due date is. The ...
0
votes
1answer
42 views

Getting this error after running my test class “System.NullPointerException: Attempt to de-reference a null object”

I'm currently modifying a test class made by someone because its getting this error. The part at which the error shows up is at the If condition. I'm not sure why it gives that error at that part ...
0
votes
1answer
201 views

If Condition for onclick not working

I am looking for a way to insert a record and close the window with the VF-Page, when everything was entered correctly and user clicks button. The values are entered correctly, if a subject was ...
2
votes
0answers
171 views

Visualforce conditional rendering formula not evaluating to True

It seems like my rendered If statement is not evaluating as expected (at least my expectations). Basically, I have 2 Id fields pulled from apex, and if they equal each other, it conditionally displays ...
1
vote
1answer
874 views

If statement in an html template

I'm trying to add some logic to our templates but there doesn't seem to be much documentation about this topic. The syntax I'm using is the following: {!IF(QA_Ninjas__c.Entities_Agregados__c>0,"...
2
votes
1answer
401 views

IN in an IF condition

This may sound silly but I was wondering if we can use an IN in a IF condition. I know we can do this in a query but suppose if I need to run multiple IF conditions on a particular object, it doesn't ...
1
vote
1answer
3k views

Nested IF formulas for a simple logic field on the opportunity

Can you please cast your eyes at my formula and spot the mistake? I've been trying to crack this but to no avail. Looked through example nested formulas and this forum as well... I know I'm just ...