We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 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
39 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
29 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
69 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
81 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
43 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
35 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
29 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
35 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
45 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
24 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
1k 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
11 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 ...
3
votes
1answer
6k 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
44 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
58 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
46 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
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
49 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
69 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
402 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
34 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
626 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
647 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
46 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
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
326 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
208 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
311 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
40 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
196 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
146 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
795 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
398 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
54 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={!...
3
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
5k 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
405 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 {!...