Questions tagged [conditional]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
3k views

Process builder check for specific user

I want my process builder conditions to update for all users except for one particular user. There is not a User option, only Owner and Profile. But the Owner of an object does not mean another user ...
2
votes
2answers
908 views

What is the purpose of this conditional markup?

I am trying to sort records and I encountered the below markup in a Visualforce Page: <apex:commandLink action="{!ViewData}" value="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','?','?')...
0
votes
1answer
30 views

Using If condtion in Visual Force page

I am trying to display fields on the basis is value is null or not. I have used below code. Its not working. I am still wondering where is mistake. I checked and confirms c.FlagEncrypted__c has ...
2
votes
1answer
507 views

How to cover condition referencing record type name in apex test class?

I'm having a hard time covering the condition in my class wherein it is checking for a specific record type name. In my test class, I've already inserted the record type desired, but there's a portion ...
2
votes
1answer
2k views

Conditionally Render A Lightning Quick Action? [closed]

I've have a component that implements force:lightningQuickAction but would like to have conditional rendering (i.e only display on the page layout if a bool field == true). I've been researching, but ...
2
votes
0answers
194 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 ...
0
votes
2answers
62 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
3answers
2k views

IF Statement AMPscript

Error I'm getting: "An IF statement is not closed with the required ENDIF statement" Please help! %%[IF @EventType=='Lunch n' Learn' THEN]%% SET @Image = Image('b3272b99-f070-4e84-a65e-2a6cae73c794')...
0
votes
2answers
381 views

Condition on column visualfoce page

Is it possible to render column values based on condition in a visualforce page? I tried <apex:outputText rendered="{!b.account.name == !a.account.name}"> <apex:column value="{!b.name}"/...
0
votes
1answer
48 views

Is it possible to write a conditional statement in the head markup of a visualforce page?

I want to write a functional statement in the head markup of a VisualForce page. Is this possible? If it is possible, what is the right way to write it? I want a different href depending on the ...
2
votes
2answers
480 views

Apex class: if objType = Project do nothing else proceed?

Forgive me but I'm a bit of a newb when it comes to Apex and found below that was written by a previous developer who worked for my company. Handler creates a task after user inserts an attachment. ...
0
votes
3answers
138 views

Conditional string based on Parameter from URL

I have passed some Parameters across the URL string and I am trying to display one of two strings dependant on the value. I'm not getting any errors in my apex or on my VFP but it is returning blank. ...
0
votes
1answer
35 views

Choose only one field

I have two fields in an object, I need choose only one of these fields. I tried using: <apex:inputField label="{!If(lang=='en' ,'Event type','Tipo de evento')}" value="{!If(lang=='en', nl....
1
vote
2answers
299 views

disable apex:commandButton is not working

Apex class: public Integer sCount {get;set;} Attachments = [SELECT Id,Name FROM Attachment WHERE Parentid =:caseId ]; Integer sCount = Attachments.size(); Vf page: <apex:commandButton ...
0
votes
1answer
58 views

How do I output 1 field value from a related based on the condition that there is 1 record with that value

How do I output 1 field value from a relatedlist based on the condition that there is 1 record with that value. I tried the following but I get an syntax error see:<apex:repeat var="ex" value="{!...
2
votes
3answers
2k views

Display tabs conditionally in record page

In the custom record page for an object, can I show or hide tabs based on record type? For example, I want to show a tab "Incident Details" if record is an Incident and "Service Request Details" if ...
1
vote
1answer
105 views

Build a Query from User Input - Too Many Permutations of If Logic

I have a Visualforce page that allows users to filter a list records based their filter criteria. My issue is that I end up having to make a permutation for every possible combination of their ...
1
vote
2answers
370 views

Inline Conditional Visualforce

I have a simple question that seems to be escaping me at the moment... The typical way I use inline conditionals is: {!IF(booleanValue,"SOMECONTENT-IF VALUE IS TRUE", "SOMEOTHERCONTENT-IF VALUE IS ...
0
votes
0answers
8k views

Check if Date field is empty

How can I check if a Date field is empty or blank? I tried this statement: if(project.Current_Launch_Date__c==null) But I don't get the desired result, even if I delete the date value, it still does ...
6
votes
2answers
907 views

In Apex, is it possible to use Polymorphism and Overloading to mitigate the need for conditional logic?

While working-on/playing with the Build a Restaurant-Locator Lightning Component Trailhead, I wanted to develop a more clever (possibly read over-engineered) way of selecting address from either the ...
2
votes
2answers
971 views

How to render after an if statement with visual force page

I have this code <apex:outputText value="{!item['text_1']}" /> <apex:outputText value="{!item['text_2']}" /> But item['text_1']} could be empty, if this is empty show text_2 I tried ...
0
votes
1answer
30 views

Writing Test Coverage for Else

I am struggling with covering this if-else conditional. public void pullIDAnalyticsReportAPEX() { crsUpdate(); generateJSON(); } public String generateJSON() { currentPgId = ApexPages....
0
votes
1answer
340 views

Process Builder: conditional update after calling Apex

I'm creating a process with Process Builder to call an apex method (that invokes a Callout Method). Everything is working like a charm. But after calling this asynchronous (@future) callout, I need ...
0
votes
1answer
356 views

How to get data from subquery and put into where clause?

bundlewithProduct = [SELECT Id, (select Product__c from Product_Quantities__r) FROM Bundle__c WHERE Id =: QBP.Bundle__c]; from the above mentioned query i am getting the list of bundle with it's ...
0
votes
2answers
3k views

Salesforce conditionally display fields based on value?

Is there a way to conditionally display a field based on its value in a Page layout only using Formula and not with VF Page or additional Page Layout. Eg: A formula field checkbox should select the ...
0
votes
1answer
163 views

validation rule conditional formulas [closed]

I need to create a validation rule on standard object "Contract" that will fire on standard Activate Button, the formula will: If(status != 'Activated' && DateOne == Null, && DateTwo =...
5
votes
1answer
388 views

How to Implement “Else If” In Merge Field?

It is possible to write two individual if statements in a style tag for an <apex:column>? I would like to do something like this: <apex:column headerValue="Priority" style="{!IF(AgentInfo....
5
votes
1answer
826 views

Two separate 'if' statements in one Apex method

I'm fairly new at Apex and have two fields that need to be set based on different criteria. I want both sets of If/Else to run, but based on looking at examples I am suspicious that maybe the second ...
-3
votes
1answer
305 views

Condition with '||' (OR) returns true always

Why is it always returning TRUE in the given logic? List<Contact> cons = [SELECT Account.Id, Email, FirstName, LastName,Phone FROM Contact where AccountId=: accId]; for(Contact c : cons) { ...
1
vote
1answer
43 views

Dynamic Visualforce generation without components

I am currently very stuck on some logic concerning a visualforce page and it's controller. Say I have the following code (I don't have any example code because I am stuck without any idea of how to ...
0
votes
1answer
72 views

Compile Error: Initial term of field expression must be a concrete SObject: String

this is checkbox S1SD1__c public static void moveStageBackward(Opportunity opp, Opportunity oldOpp, String newStage, String oldStage){ Map<String, Schema.SObjectField> objectFieldMap = ...
1
vote
1answer
573 views

Render section or display error message

I have a requirement where I want a section to render depending on a value of a controller variable. If the section is not rendered I want an error message to be displayed. I have the following piece ...
1
vote
1answer
3k views

Apex Command Button onclick condition

This is a generic question Can I add <apex:commandbutton onclick="if condition? result 1 else result 2"> I would really appreciate a simple example if this is possible. Thanks in advance
2
votes
2answers
1k views

Conditional Cell Color in VF dataTable

I'm using a custom controller to query OpportunityFieldHistory to find changes to Close Date within a given timeframe. Then, the query results are displayed in a VF dataTable. I can display OldValue ...
4
votes
2answers
3k views

Can you use a NOT on Set Contains method?

Is it OK to use a NOT on (negate) a Set.contains() method, or should I use an if/else, or does it not really matter? Use NOT on contains(): if (!psxAssigneeIds.contains(cgm.MemberId)) { ...
1
vote
1answer
264 views

Simple conditional statement

%%[IF AccountNumber == "12345" THEN]%% html %%[ELSE]%% html %%[ENDIF]%% Explodes when attempting to validate: Error 1: Script IF Statement InvalidAn error occurred when attempting to resolve a ...
0
votes
1answer
873 views

Why shippingpostalcode is showing (variable does not exist)

Here is my apex trigger but it is unable to recognise 2 fields i.e. billingpostalcode and shippingpostalcode. trigger AccountAddressTrigger on Account (before insert, before update) { for(...
1
vote
2answers
5k views

Apex trigger to throw error message

I have below Apex trigger code which fails to enter first if condition which it should do. Can someone suggest me a way out if by maps or other kind of developments? Please note System.debug('@@@...
1
vote
1answer
65 views

Conditional OR not working as expected

I am not sure what I am missing, I am trying to execute something only if the value of 2 parameters are not empty. So if 1 or both are empty, excecute code a, if both values are not empty, excecute ...
0
votes
1answer
212 views

Formula for Picklist with If Conditions

I have 1 pick-list called Ward Types. Ward Type items are, Suite Deluxe Special AC Semi Private General Ward I want the formula for if(WardType__c == 'Suite') { Amount__c = 500; } if(...
0
votes
1answer
7k views

Conditionally Showing an apex:outputPanel

On a custom VF page, inside of an apex:repeat component I have two apex:outputPanel components. I want to show one apex:outputPanel when a checkbox field on the record is true/checked and I want to ...
0
votes
1answer
57 views

Can anyone please explain me this if Statement? What does this ! sign at the begining of if statement stands for?

Can anyone please have a look at this if statement and explain me what this ! at the beginning of if statement stands for? Isn't that means not? but that doesn't make sense here . <apex:...
0
votes
1answer
141 views

Conditional highlighting rules

I would like to highlight fields with amount 0 with red colour. And all the others to be without colour. For some reason I'm getting all the fields red when I set conditional highlighting as on the ...
2
votes
1answer
2k views

Visualforce IF Statement

The code below is a section in a VF email template that should conditionally output a link to all the Legal Request records where Request Type == Sales AND Service Type == New Business, but something ...
1
vote
1answer
189 views

Formula Field to get most current year from 3 fields

I have 3 different fields that track year in the form of text (4 characters). I'm trying to create a new formula field that would give me the latest year out of all 3 fields. For example: field1= ...
2
votes
1answer
808 views

List.add( value || 'default value')?

After querying for Account sObjects, I'm adding all the fields into a List. The problem is that some Account sObjects have certain fields and others do not. While adding the fields to my list, I'd ...
0
votes
1answer
208 views

ISBLANK condition not working

I want to display a button but only when two fields are matched (Category__c = Events & Custom_URL__c IS NOT BLANK). <apex:outputLink value="/register" id="register" rendered="{!IF(AND(article....
4
votes
1answer
13k views

Adding multiple conditions in rendered argument

I have a link that I want to display when Category = 'data1' AND Custom URL = 'data2'. I know how to do this with only one condition, how can I do this with two conditions? <apex:outputLink value=...
0
votes
1answer
3k views

Logical Help needed - FATAL_ERROR|System.NullPointerException: Argument cannot be null

I have List of Employee's, Now Want to create my ThirdObject record if Condition 1) objEmp.Location__c ==null as well as If Condition 2) objEmp.Location contain in objSecondObject.SecondLocation__c ...
1
vote
1answer
2k views

Visualforce: calling method as an action inside conditional statement

This is working code, saying that Telemarketing users are routed to a standard New Event page, while other users are redirected to MyPage: action="{!if($Profile.Name !='Telemarketing', urlFor($Page....