Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
35 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
24 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
24 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
23 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
32 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
44 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
18 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
633 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
10 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 ...
1
vote
1answer
3k 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
42 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
55 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
33 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
52 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
61 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
32 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
52 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
237 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
33 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
33 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
25 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
443 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
496 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
34 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 ...
8
votes
2answers
1k 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
234 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
1k 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
198 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
283 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
888 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
39 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
184 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
129 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
723 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
396 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
2k 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 ...
0
votes
2answers
50 views

IF this or this or this?

I am trying to implement the below code, but I get this error: OR operator can only be applied to Boolean expressions Code: public class Segment { static List<Map<String, Object>> ...
1
vote
1answer
3k views

Custom Button Formula URL IF condition

IF( NOT(ISNULL(Submission__c.DPM_Project__c)), ahttps://url.aspx?PROJECTID={!Opportunity.Name}&LOCATIONID={!Opportunity.Location__c}&INNCODE={!Opportunity.Inn_Code__c}&BRANDCODE={!...
2
votes
2answers
2k views

IF Statement on the VF page to display/hide Related list(s)

How can I display/hide related list(s) table on a VF page for a custom object using IF statement? I am currently displaying 3 separate related lists on my VF page using HTML markup, one of those: <...
0
votes
1answer
29 views

Ternary Operator error - Error: Compile Error: expecting a colon, found ')' at line

(!GWB_Utility.isNull(cust.FinancialIndicator)?cust.FinancialIndicator == 'Y'? 'Yes':cust.FinancialIndicator == 'N'? 'No':null); Idea - the value will be either Y/N/Null - If it's Y show Yes , N show ...
0
votes
1answer
1k views

Using IF statement in a VisualForce page's For(repeat) loop?

I am trying to display fields with some static text based on another field's value. <apex:repeat value="{!caseHistory}" var="casHistory"> <div class="section1"> ...
1
vote
1answer
4k views

Using AND OR in AmpScript IF THEN statement

I am can't figure out something I think is pretty simple. I have an if/then statement and I want to evaluate three things: %%[if @PromoCode == "XXXX" OR @Tier == "XXX" AND @Price == "100" then]%% ...
1
vote
1answer
369 views

How to subtract apex variable in IF condition of Visualforce page

<td style="text-align:center"> {!IF(Project.pse__Planned_Hours__c - {!grandtotalAH})> 0,Project.pse__Planned_Hours__c-Project.Total_Billable_Hours__c,0)} </td> I want to subtract {!...
1
vote
3answers
669 views

Logically comma separating address field to form a String

I am trying to create a string of address in this format: Street, City, State, Country, Zip. Assume that there is an Address object called addr which has account's shipping address. Address addr = ...
0
votes
1answer
58 views

ERROR deploying ApexPage Syntax error. Found 'IF'

I am trying to use IF on my VF page. But I am getting this error. What's wrong? <apex:inputText value="{!IF(CONTAINS(stringOfKeys, item.Id), orders[item.itemId], '')}" id="bVAL"/>
2
votes
2answers
2k views

comparing and assign values to a variable on same line

I saw this kind of logic somewhere in an apex code and got curious about how this can be done. The code is a one liner and does variable check and assignment in the same line. It uses the <> ...
0
votes
1answer
877 views

IF condition is not working properly in HTML email template

My requirement is some what exactly like this post. But the difference is, when MaxBath__c field not viewable(Which means MaxBath__C field have null value), then i should show some symbol like #. I ...
1
vote
2answers
713 views

Aura :iteration and :if, WARNING: Performance degradation..

I'm receiving a WARNING: Performance degradation: Multiple items were set in iteration message. This occurs in the code below when the aura:if element is there, but not when it isn't. Each group ...