11
votes
Accepted
Boolean Value Resets to True in Test Method
if (standardSearch = true) {
You are performing an assignment with = inside this if statement. Use == to compare for equality.
As a guard against this kind of mistake, you can write the constant ...
9
votes
Accepted
Apex `if (Boolean) `. Null exception virtually renders this check useless and unsafe
It's allowed because a Boolean is already a Boolean; the syntax for an if statement reads if(condition), where condition is a Boolean value. It's considered a best practice to always initialize your ...
9
votes
Accepted
lightning component empty field check?
Use empty to determine if something is empty (or, in this case, not empty):
{!not(empty(v.guid))}
However, I'm not sure you can do all this with the "default" attribute, since it's not meant to be ...
4
votes
Accepted
Get Boolean result by String expression in APEX
Answer of your question:
No even if you replace complete String with actual expression there is no way you can parse it. For parsing the expression you would need to write the parser.
Write Parser:
...
4
votes
Trigger.oldMap.get on a boolean field
Those maps are keyed by record Ids. So when looking for differences between the values of of the fields in the old and new records use this pattern:
// n = new version of record
// o = old version of ...
3
votes
How to get value for boolean variable from controller
All parameters are passed as strings so you will have to do this:
if you are not going to ever call the controller from anon apex and always be in VF context you can do this (sfdcfox):
boolean pbv = ...
3
votes
Accepted
Variable does not exist - global Boolean and webService Argument
Non-static variables (commonly called instance variables) are specifically contained in an instance of a class. Static variables, contrariwise, are stored in class' static storage area, of which only ...
2
votes
Variable does not exist - global Boolean and webService Argument
You can't assign instance variables from a static context.
Instead of:
global boolean awsUpdate;
Use:
global static Boolean awsUpdate;
Or consider public/private access modifiers if they are ...
2
votes
How do I use a formula text field to display in a record whether a candidate has been approved or not, based off a checkbox?
In a formula (formula field, workflow, process builder, flow), the IF() function takes 3 arguments (as indicated in your previous question by looking through the Formula Operators and Functions).
...
2
votes
Accepted
Formula field date subtraction
Simple date subtraction, as Amit suggests in the comments, would be a decent approximation. Datetimes (and their closely related cousin, Dates) can be subtracted to give you a decimal (in the case of ...
1
vote
Accepted
How to split a multiselect picklist into a String array and check if it contains a specific value within an iteration?
Your constant is Non-Inherited (uppercase I), while the value in the multipicklist is Non-inherited (lowercase i), they are not the same string.
Only the equality operators (==) and WHERE clause in ...
1
vote
1
vote
Accepted
LWC Boolean Properties
as per the documentation says
Always set the default value for a boolean public property to false. If you set the default value to true instead in bool.js, there’s no way to statically toggle the ...
1
vote
Formula field - Trying to show a flag if checkbox = true
You need to use the field API Name instead of label name (Response Timer Failed) in the formula field.
your formula should be like below and the formula return type should be text
IF(...
1
vote
Accepted
How to change boolean result to a compatible currency value in a formula field
A few things to note here:
When you are making multiple comparisons against a single field, you should consider using CASE() to save yourself a potentially significant amount of typing
A formula ...
1
vote
How to change boolean result to a compatible currency value in a formula field
Remove the last IsBlank(null) instead, just make it null. By saying IsBlank, you are returning true (as null is always blank) and hence the complain from the compiler.
1
vote
Accepted
Trigger.oldMap.get on a boolean field
Trigger.old is Map of Case Id and Case instance.
To retrieve the field values, you will need to specify the ID as index and then the field name to get the corresponding values.
Trigger.oldMap.get(...
1
vote
Accepted
Variable Global is not changed
It sounds like this is what you're attempting to do from the comments. This exposes a public method that grabs the internal variable from a private static method which gets it from the private static ...
1
vote
Accepted
Insert or Update Custom Metadata Type Boolean Field
The issue is that you are specifying incorrect data type.
<values>
<field>hdone__IsActive__c</field>
<value xsi:type="xsd:string">yes</value>
</values>
If ...
1
vote
Accepted
SOQL: Retrieve records based on List of Booleans
Architecture and Data Model Commentary
You may have very good reasons for adopting this data model, but looking in from the outside I think it's going to cause you more problems than it helps. If your ...
1
vote
Accepted
"This field may not be empty" - it isn't!
I'd suggest opening a support case.
As a work-around, you can export the data, fix the values in the file and re-import it.
Also, make liberal use of the Feedback button at the top of the page. ...
1
vote
Accepted
Custom Boolean Field Retrieve
I strongly suspect that there is something wrong with enterprise WSDL.
possible options to check are:
Check if the WSDL is latest or not
Check the path of WSDL - its possible that you may be ...
1
vote
Accepted
Can't update Boolean value of Account object
You need to set the RecordTypeId to a Person Account record type, or you won't be able to use "PC" fields. Also, you cannot use the Name field for a Person Account, because it's used only on Business ...
1
vote
Accepted
Calculate and Output a checkbox in Visualforce
You can do this with a normal "input", but it's pretty painful. Here's what it would look like:
<apex:outputText rendered="{!NOT(ISNULL(current.Text__c))}">
<input type="checkbox" checked="...
1
vote
Can you filter on a Boolean/Checkbox in a Marketing Cloud SQL Query
Try subbing True for 1 and 0 for False. It should work. In SFMC these work as booleans values.
SELECT
c.Id
, c.Email
, c.FirstName
, c.LastName
, c.Checkbox__c
FROM Contact_Salesforce c
WHERE ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
boolean × 48apex × 22
visualforce × 5
trigger × 5
formula-field × 5
marketing-cloud × 3
soql × 3
unit-test × 3
custom-field × 3
string × 3
update × 3
rendered × 3
lightning-aura-components × 2
formula × 2
custom-object × 2
controller × 2
aura × 2
list × 2
sobject × 2
custom-metadata × 2
conditional × 2
method × 2
checkbox × 2
inputcheckboxes × 2
lightning × 1