Questions tagged [conditional]
The conditional tag has no usage guidance.
166
questions
9
votes
2
answers
3k
views
Ternary Operator Compile Failure. Incompatible types in ternary operator
Assume we have some code in Apex:
APEX
Boolean isString = true; // or false
List<String> labels = new List<String>{ 'Label' };
Object entity = isString
? labels.get(0)
: ...
0
votes
1
answer
31
views
Conditional not rendering output section
I have a pageblockSection I want to render if a conditional evaluates to true.
This is my VF code
<apex:page standardController="Intake__c" extensions="IntakeExtension,...
1
vote
0
answers
482
views
Contact duplicate rule condition is not working on Lead convert (Apex)
I have written custom Lead Convert apex class and vf page.
I have a duplicate rule "active" on contact.
The issue i am facing - When i try to convert a lead, contact duplicate rule's ...
0
votes
1
answer
2k
views
SOQL in Apex IF-Else Condition
I am trying to filter records based on the below if-else condition in apex code
if (salesId != NULL) {
List<Entity__c> entity = [SELECT Status__c,
Item__r.Vendor_ID__c
...
1
vote
2
answers
3k
views
AMPscript issue with a conditional (boolean)
how are you? My excersize is to compare 3 clients with a boolean and i would like if my code is okay. Let me show my code. I just checked the ampscript guide but it isnt enough. Looks easy but i'vent ...
0
votes
0
answers
478
views
Process Builder - Auto Create Event after a call is logged
What I am trying to do ?
When a Call is logged (via Log a Call), Create a follow up event automatically.
How did I do this ?
I created a workflow via Process Builder to auto Create Events when a call ...
0
votes
2
answers
1k
views
Conditionally disabling an editable field in lightning Datatable
I have a requirement that an editable field in Datatable should be editable on certain conditions for example lets say, i have a field Disable_Action__c which is a formula field , when this field ...
0
votes
1
answer
38
views
I'm trying to avoid or at least organize better expressions inside if statement in my code
Need help, my code has a lot of expressions in if statement and I'm trying to get rid of it or organize it in a better way.
for example like this:
if (fieldNumber==1 && (language=='en' || ...
1
vote
1
answer
3k
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
1
answer
22
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 - ...
0
votes
2
answers
694
views
Is there a way to dynamically generate conditions in a loop
I currently have a batch proces which gets an amount of records as a scope. I want to execute some manipulations on these records based on some conditions where only 1 value changes and where the ...
2
votes
1
answer
4k
views
My LWC radio button select is not working - not getting selection
I have a Lightning Web Component with a radio button group. If I select one, I need to capture the selection and conditionally display a div based on that selection. I can't seem to get it working - ...
0
votes
0
answers
42
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 ...
0
votes
0
answers
207
views
Replace default Lightning Table Sort Icons with Custom Icons
We have a table this is referencing the default lightning sort icons and need to replace all three(up, down, both) with different svg images from static resources.
The current code references ...
0
votes
1
answer
358
views
Dataloader Condition: Accounts with Contacts, Opportunities, etc.?
Is there a way in Dataload to add the condition when exporting Accounts so that it only pulls Accounts with Contacts, Opportunities, etc.?
Thanks
0
votes
0
answers
2k
views
LWC: How create/edit record with fields displayed depending on the values of these fields
How create/edit record with fields displayed (hide/show) depending on the values of adjacent fields?
What are the best practice for that case?
Thank you!
For example:
HTML
<template if:true={...
0
votes
1
answer
2k
views
How to show fields based on a condition for other field
I want to show 4 custom fields (W__c, X__c, Y__c, Z__c) when other custom field have the following condition:
If RealNumber__c < TargetNumber__c
then show this field:
W__c, X__c, Y__c, Z__c
else
...
-1
votes
2
answers
364
views
Conditional formula field
If I have the object Animal__cwith the fieldsColor__c and Shape__c. How Can I make a conditional formula field Country__c which is dependent of the values ofColor__c. Example:
If (Color__c ='...
0
votes
1
answer
438
views
Outputtext rendered conditional check not working with < or >
This is my VF outputtext which works fine:
<apex:repeat value="{!port.hList}" var="per">
<tr>
<td>
<apex:outputText value="{0, Number, #,###,###.00}" rendered="{!...
3
votes
1
answer
2k
views
Is it possible to conditionally set the value of an input component?
I tried to create an input component as follows:
<aura:attribute name="dataTotal" type="Map" />
<aura:attribute name="myBoolean" type="Boolean" />
<lightning:input type="number" value=...
5
votes
4
answers
4k
views
Conditional rendering based on key in for:each
I'm stuck on how to conditionally render (let alone apply styles) while in a for:each according to an expression.
<lightning-layout-item padding="around-small">
<div class="header-column"...
1
vote
1
answer
1k
views
Component Visibility in Flow's Screen with Number data type
I'm trying to set up a filter to manage a component visibility in a flow's screen component. In particular, I want the field to be available to the user for the insert of data only when a particular ...
6
votes
2
answers
28k
views
How do I check if a record exists in Flow Builder?
I have an autolaunched flow to create a record with particular field values, unless a record with the same values already exists. This answer offers a method for interactive flows. This answer says ...
3
votes
1
answer
3k
views
How to conditionally render inside a datatable in lightning?
I have a lightning datatable and into one column called 'Set Primary Contact' I want to display an icon if the custom field IsPrimaryContact__c has the value TRUE, or a button 'Set primary contact' if ...
0
votes
1
answer
319
views
How do I make a field mandatory if the previous field is set to yes?
I need some help with JavaScript code, please. In Salesforce Communities, I have a form that asks a question, if you answer yes, then more fields appear. I want to set it to if yes, those fields ...
2
votes
1
answer
2k
views
LWC Conditional rendering: alternative for fetching the initial database value?
Looking for a conditional rendering solution in lwc, which uses the initial value of a field in the database to decide whether to render or not. I have found a way to get it working, but it seems like ...
2
votes
1
answer
178
views
Only the first IF condition works, and the rest doesn't when nested in Process Builder formula
GOAL: I'm trying to create this criteria in Process Builder where I can detect phone number like (000) 000-0000, 000-000-0000 and 000.000.0000 and turn them into +1 0000000000 format.
I tried to ...
0
votes
2
answers
961
views
Lighting Aura Controller - If Then on checkbox
I cannot figure out the correct syntax to evaluate a checkbox field on my component. I have to believe I have the syntax wrong because the IF statement is being executed even though the checkbox is ...
5
votes
1
answer
1k
views
CPQ quoteline conditional custom action
I am trying to set up a conditional Custom Action on a CPQ Quote Line. I only want the Desegment Line Custom Action to appear when a custom field "Segmentation_Editable__c" has a value of true.
I ...
0
votes
1
answer
1k
views
Why does Visualforce inputField using html-disabled = false still disable the field?
In my VF page I need to disable an inputField based on a boolean condition set in my controller. If I add the html-disabled option to the inputField it disables the field, regardless of what I set the ...
0
votes
1
answer
840
views
Conditional display of Visualforce page on account layout
I'm new to Salesforce and i wonder how i can conditionally display visualforce page on account page upon that button click as illustrated on image .
0
votes
1
answer
5k
views
Render if variable contains text value in visualforce
I am trying to use render if condition on a viasualforce based on a value containing a string but this seems not to work. What am I missing? See:
<apex:pageBlock title="Manuals">
...
2
votes
1
answer
3k
views
LWC: Use data from outer iteration in inner iteration to conditionally render?
let's say I'm building a Kanban board using LWC, and I have the following markup:
<template>
<div class="kanban-container slds-border_left slds-p-around_medium">
<template ...
2
votes
1
answer
1k
views
Aura if and order of execution on conditions
I'm working on showing a component if he is not admin, nor from France, Suisse or Canada :
v.userProfile --> true for admins, false otherwise.
Even for Swiss users, the component was displayed.
I ...
0
votes
0
answers
25
views
how to use .getvalues with map and display the picklist value from custom setting on VF page thoghing null pointer exception [duplicate]
have a custom setting called product and under that i created two fields called and other is string field BD__c. i want to display picklist value based on string matching record. my custom setting ...
3
votes
1
answer
21k
views
Aura if - isTrue parameter and multiple conditions
I'm trying this code :
<!-- an exemple :
isTrue='{!and(v.valueOneIsTrue, v.valueThreeIsTrue)}" >-->
<aura:if isTrue="{!AND((v._candidateDetails.contact.Nationalite__c != null), (v....
7
votes
1
answer
37k
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
1
answer
110
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
1
answer
78
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
1
answer
3k
views
Process Builder Formula Conditions are met
Sorry I've been drilling this for 8 hours and I'm stuck...
I can get this to work using "Formula Evaluates to to True"
NOT(CONTAINS([User].Email, 'gmail') )
But I can't get it to work using "...
0
votes
2
answers
1k
views
Compare two columns from different data extensions
I'll get right into it. - I am trying to do the following:
I have two DEs one is my send DE, the other is a lookup table.
Let's say both data extensions have a column called [STATE].
The send DE ...
1
vote
1
answer
516
views
Conditional Visualforce Component call from Visualforce Page
We have to visualforce components. I wanted to call the components based upon a flag on the custom object.
I ended up with the following visualforce page, which works, but since I am not really a ...
0
votes
1
answer
4k
views
ELSE IF Condition in Ampscript
I'm working on a cloud page where i would like to use an ELSE IF condition instead of two IF conditions. Does any one know a syntax for ELSE IF
Below is my current Ampscript code. These are captured ...
1
vote
1
answer
60
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(...
1
vote
1
answer
692
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 ...
-4
votes
2
answers
2k
views
Visual Force render text based on conditional? [closed]
I want to make an output text render specific text based on a condition, for example, a variable is a certain value.
Is there a way to do an if statement in VF?
1
vote
2
answers
11k
views
Conditional Rendering in Lightning Component with more than Aura:If(True, ELSE)
I have a lightning:select picklist on a Lightning component called "Best Method of Contact" which is a required picklist, but the required picklist defaults to a blank 'placeholder' value that the ...
0
votes
1
answer
52
views
If condition not working
If condition in a trigger has weird results. My condition is, if there are no values from my Set collection do not proceed. Even my debug statement shows NULL value. why this is happening??
if(...
0
votes
3
answers
842
views
Aura:if displays both options
I have a problem with aura if in lightning component, the condition doesn't work, my code below :
<aura:if isTrue="{!v.account.cel_email_mailable__c != 'N' }">
<div onclick="{!c....
4
votes
1
answer
17k
views
lightning component empty field check?
<aura:attribute name="guid" type="String" default="{!v.simpleRecord.Loan_Guid__c}"/>
<aura:attribute name="fileCreated" type="Boolean" default="{!v.guid != '' ? true : false}"/>
...