6 votes
Accepted

How to use variables in JavaScript without exposing them in the browser?

Is there any way to use the variables inside the JavaScript without exposing to browser? No, you cannot secure JavaScript against attacks from the client. All processing of secrets and authorization ...
David Reed's user avatar
  • 92.6k
6 votes
Accepted

How do you share variable values across multiple blocks within an email?

Ampscript process from the top down so as long as the variable is defined in a content block above where you are referencing it, it will work.
EazyE's user avatar
  • 8,449
4 votes
Accepted

Accessing variables in a SOQL query

With AggregateResult, you need to use the .get(String) method to access things. e.g. AggregateResultList[0].get('name'); The return value of the sobject's .get() method is an Object, which means you'...
Derek F's user avatar
  • 60.9k
4 votes
Accepted

Can't get flow variable from flow interview I created and started in Apex

Make sure your flow variable is available for both output and input. This is likely to fix your issue.
Caspar Harmer's user avatar
3 votes

Config enviroment variables in Salesforce

There is a new feature in the Salesforce CLI version 7.176.1 documented in the release notes. Replace snippets of your metadata source files with specific values right before you deploy the files to ...
Mohith Shrivastava's user avatar
3 votes

Formula Assistance

You are using the wrong syntax for Flow formulas (you were using the Process Builder syntax) Assuming this is a record-triggered flow on Opportunity, then $Record contains the flow interview's ...
cropredy's user avatar
  • 70.8k
3 votes
Accepted

How can I make the variable dynamically

All types such as bt__c support the SObject methods described here SObject Class presumably by extending SObject. And there are various "describe" method to convert string names into tokens ...
Keith C's user avatar
  • 136k
3 votes
Accepted

LWC pass date to @wire apex - how to initialise date variable?

Wire methods don't fire on "undefined". You need to make it null instead: inputDate = null; Or, alternatively, set a specific date: inputDate = new Date(new Date().setFullYear(new Date()....
sfdcfox's user avatar
  • 487k
3 votes
Accepted

Variable does not exist in in method

There's a couple problems here. First, you've declared NewToolsMap as an instance variable of NewToolsTaskHandler, but you've then shadowed it with a local declaration inside the DoInitialize() ...
David Reed's user avatar
  • 92.6k
3 votes
Accepted

How do I invoke an apexclass from flow and return a list back to flow

The Flow mechanism is bulkified. This means if you return a List<String>, it will map to a single variable, while List<List<String>> will map to a collection variable. You'll need to ...
sfdcfox's user avatar
  • 487k
3 votes

Visual Studio Code debugger - how do I see content of object or map?

Limitations of Apex Replay Debugger in VS Code https://developer.salesforce.com/tools/vscode/en/apex/replay-debugger This is under the "Considerations" section. I don't even think using checkpoints ...
Kris Goncalves's user avatar
3 votes
Accepted

Duplicate variable is not detected as duplicate after compilation

It's not a duplicate variable. You are allowed to have a static variable and an instance variable of the same name. They are in a different scope. You can, in fact, have up to three variables with the ...
sfdcfox's user avatar
  • 487k
2 votes
Accepted

Setting Invocable Variable value for a Test Class

Your problem has nothing to do with invocable variable. You are trying to access the 0 index element immediately after creating instance Parametri in test class. You should add element in list ...
salesforce-sas's user avatar
2 votes
Accepted

How to add dynamic value to URLFOR after path

Rolling up from comments. You don't need to refer ! in {!file.ContentDocumentID}. Removing that should work. <a href="{!URLFOR('/sfc/servlet.shepherd/document/download/' + file.ContentDocumentId)}...
Jayant Das's user avatar
  • 30.5k
2 votes
Accepted

How to adress method in class

This class has an explicit constructor that takes an object type, so you need to construct the instance passing in an object type: String someObjectType = ...; // Set it somehow. In this case null ...
Phil W's user avatar
  • 35.6k
2 votes
Accepted

Assigning values to variables in a loop

You would have to build it out as a string and then do a TreatAsContent. Something like below: %%[ set @email = AttributeValue("Email") /* value from attribute or DE column in send context */...
Gortonington's user avatar
  • 30.5k
2 votes
Accepted

Apex Convert Positive Currency to Negative Currency

Some languages allow a bit more fluidity in data types (weakly/loosely typed languages), but not Apex. Apex is "strongly typed", which means that there's basically no flexibility. If ...
Derek F's user avatar
  • 60.9k
2 votes

Variable does not exist Id developer console error

Your code, as written, has several issues with it, but let's focus on the error first. Explaining the error You're getting this error because you're trying to get an Id from a List. You define ...
Derek F's user avatar
  • 60.9k
2 votes

Variable does not exist Id developer console error

This accountContact is a Map<Account, List< contact>> So if you do accountContact.get(acc).Id; it will return you the List<Contact>. Which does not have direct Id, you need to loop ...
Nagendra Singh's user avatar
2 votes
Accepted

AMPscript EMPTY OR NOT EMPTY

I am not sure if I understood you correctly but based on your description and comments that is what you wanted to do: %%[ VAR @Salutation, @FirstName, @LastName SET @FirstName = AttributeValue("...
Niko's user avatar
  • 2,680
2 votes
Accepted

How to convert Map<String,List<String>> to Map<String,String>?

This is because you never create a new user in memory, so they all reference each other. As a basic example: User u = new User(); User u2 = u; u2.LastName = 'Fear'; System.debug(u.LastName); // Fear ...
sfdcfox's user avatar
  • 487k
2 votes

Assign Field based on Alpha Split of Contact Last Name

A formula isn't really scalable (ex. when you have more conditions, more counselors, to make frequent changes, etc), but if you simply have 4 conditions - it can work. You'd leverage IF, CONTAINS, and ...
Kris Goncalves's user avatar
2 votes
Accepted

How do I pass a variable to a flow component on a Lighting page (that is NOT the recordId)?

I don't believe it's possible to pass a field reference (other than record Id) from the App Builder into an input variable on the Flow. Your best bet would be to pass the entire Sobject record. You ...
Kris Goncalves's user avatar
1 vote
Accepted

Error with AMPscript variable declaration in Free Form block

It seems you put it in the text area and this will transform everything into html code then cause this error. In the Free form block, you can open the "HTML Editor" tab and try to put the ...
Duc Le's user avatar
  • 3,038
1 vote

Assign Field based on Alpha Split of Contact Last Name

In addition to Kris' answer CASE(LEFT(Contact.LastName,1)), 'A','Counselor1Id', 'B','Counselor1Id', ..., 'F','Counselor2Id', 'G','Counselor2Id', ... NULL /* or 'defaultId', ...
cropredy's user avatar
  • 70.8k
1 vote
Accepted

Illegal Assignment error when dealing with custom sort class

Your .get() from the list returns the wrapper itself. You want the record that is inside the wrapper instance. For clarity, I broke it out into two lines. You can recombine the syntax into a single ...
Mark Pond's user avatar
  • 22.9k
1 vote
Accepted

How to use variables in dot notation to find child relationship name?

You can get Schema information dynamically by leveraging some of the dynamic Schema methods like describeSObjects which takes a list of strings. I've taken your code and written a method that accepts ...
nbrown's user avatar
  • 4,004
1 vote
Accepted

Ampscript - Inputting Variable inside SET Statement

Your @First_Name variable's being used inside quotations, so it interpreted as a string and not being substituted. Build your Subject variable using Concat(). Email Body %%[ VAR @Subject SET @...
Macca's user avatar
  • 8,196
1 vote
Accepted

Static variable is cleared between page load and button click - how do I keep the values?

Static variables are cleared on each transaction start. Instead, you'd make the variable non-static, which would place the account in the view state. However, I would point out that other users may ...
sfdcfox's user avatar
  • 487k
1 vote

How do I invoke an apexclass from flow and return a list back to flow

Alternatively, a wrapper class can be maintained for flow variables. The variables can be marked with the annotation @InvocableVariable. Multiple variables can be returned from the method and also ...
Prakhar Saxena's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible