Hot answers tagged

27 votes
Accepted

Does Apex transpile into Java?

The actual documentation for this process is internal only. You might get a glimpse if you were to sign a Non-Disclosure Agreement (but I wouldn't hold my breath). However, here's some fun reading: ...
19 votes

Salesforce Metadata Api/ Tooling Api to build changesets

It turns out you can directly retrieve and update changesets directly with the Metadata API. Via Sean Harrison‏: Pro tip: U can retrieve the contents of a change set incl. manifest with the ...
user avatar
14 votes
Accepted

What is Apex built on?

@mattandneil showed me this, which explains that prior to January 2012, Apex would be compiled into an Abstract Syntax Tree (AST) node graph which would then be traversed for every request to that ...
user avatar
13 votes
Accepted

Can Data Loader run with 64-bit Java?

Well that was easy (does that sound sarcastic?). I installed the 32-bit Java runtime environment, so now I have two JREs: 32-bit one in C:\Program Files (x86)\Java\jre1.8.0_73 and 64-bit one in C:\...
user avatar
9 votes
Accepted

Trying to get SymbolTable of an Apex class and get null

As per the ApexClass documentation. If there is not a cached version of SymbolTable, it will be compiled in the background and the query might take longer than expected. The SymbolTable returned from ...
user avatar
9 votes

Functional programming utilities in apex

Apex is a very static language. For example, you cannot reliably determine the class name of an object at run time (Can I determine the class name of an object instance at run-time?). Generics were ...
user avatar
  • 3,615
8 votes
Accepted

Create an Apex class that calls a REST endpoint and write a test class - Trailhead

This is the step by step approach for this implementation. Animal public class Animal { public Integer id; public String name; public String eats; public String says; } AnimalResult ...
user avatar
7 votes
Accepted

Passing custom model to Apex REST custom endpoint

You can design your own interface using simple Apex classes. So to allow this JSON to be posted: [ {"query": "SELECT ...", "externalId": "65202639238"}, {"query": "SELECT ...", "externalId": "...
user avatar
  • 130k
6 votes

Capture Salesforce Outbound Message with a Java SOAP Listener

http://requestb.in will let you see the XML that an outgoing message will send. So basically you need to do the following: Add requestbin url in remote sites of your salesforce instance Get a ...
user avatar
  • 1,000
6 votes
Accepted

Getting salesforce instance URL from Java

When you call the Partner API login() method it will return a LoginResult. It will have the: serverUrl URL of the endpoint that will process subsequent API calls. Your client application needs to ...
user avatar
6 votes
Accepted

ErrorCode 180008 - Unable to queue Triggered Send request. There are no valid subscribers

Make sure you checked the option Add subscribers to this list under Subscriber Management when creating your triggered send. To verify this option, go to Email Studio > Interactions > Triggered ...
user avatar
6 votes
Accepted

Is there a zero-downtime way to rotate the server credentials used by force-wsc?

A properly written force-wsc app (or any other SOAP-based application) won't immediately be affected by password change; this is because a session remains valid even if the username or password for ...
user avatar
  • 438k
6 votes
Accepted

can i pass variable values from ampscript to javascript?

I think what you are missing here is that Salesforce Marketing Cloud Server Side JavaScript is not the same as JavaScript that runs on the browser. Adding runat="server" to the script block causes ...
user avatar
  • 388
6 votes
Accepted

Does Crypto.generateMac method work exactly the same as Mac and SecretKeySpec java classes

Your Apex code just misses the base64 decoding step on your secret key. If you change the call to generateMac() to this: Blob mac = Crypto.generateMac(algorithmName, Blob.valueOf(input), EncodingUtil....
user avatar
  • 87.3k
6 votes

How to add many values at once in Apex?

You can initialize list with your items: List<String> l = new List<String>{'a', 'b', 'c', 'etc'};
user avatar
5 votes
Accepted

How can I set an SObject field to null using Java API?

Salesforce has a "fieldsToNull" array in its update API as described in the update documentation. Exactly how this is exposed depends on the tools used to generate the Java code from the WSDL but it ...
user avatar
  • 130k
5 votes
Accepted

What are the main differences between APEX and Java

Inner classes and interfaces can only be declared one level deep inside an outer class. Static methods and variables can only be declared in a top-level class definition, not in an inner class. Inner ...
user avatar
  • 94
5 votes

Capture Salesforce Outbound Message with a Java SOAP Listener

Salesforce auto generates the XML format of the message that is sent to external system. You do not need to provide a WSDL to salesforce if you are implementing an outbound messaging. Only Endpoint ...
user avatar
  • 7,683
5 votes
Accepted

How to set TLS Version in Java SOAP API

The problem here is that although Java 7 and higher support TLS 1.1 and 1.2, they are not enabled by default. You can enable them by using: System.setProperty(“https.protocols”, “TLSv1,TLSv1.1,TLSv1....
user avatar
5 votes
Accepted

Cannot retrieve full class list from the org using tooling API?

You will need to change your strategy as including all the class names you have already queried is causing the query string to exceed the 20,000 character query limit. The Partner API includes the ...
user avatar
  • 130k
4 votes
Accepted

Error Code 310007. A primary key field cannot be nullable

This is totally not obvious, but you actually want to be using IsRequired=true on your primary key field, not isNillable. This is how you make something not nullable.
user avatar
  • 3,207
4 votes
Accepted

Rest API 400 response for Opportunity insert

Posting my comment as the answer so it can be marked as accepted... It might be the format you're using for the CloseDate - typically, it uses the format "2014-08-08". If that doesn't fix it, do you ...
user avatar
  • 859
4 votes

Where can I find Java FuelSdk Examples?

These examples are available starting here. There are specific code snippets available for most common use cases. Create Campaigns - Look under Java tab Retrieve Campaigns - Look under Java tab ...
user avatar
4 votes
Accepted

Limitations in functionality of SOAP/REST/etc. API as opposed to a Force.com app?

The short answer to the specific question "is there anything in the exposed SOAP/REST APIs which isn't available when using the platform and tools" is, for all practical purposes - no. In fact, it's ...
user avatar
  • 3,384
4 votes

How can I get system apex classes using SOAP API (or any other API)

Apex Code doesn't have proper "reflection" like actual Java. Furthermore, the system classes do not expose their source code. Many system classes are actually not real classes, but pseudo-classes that ...
user avatar
  • 438k
4 votes
Accepted

Can I save a new Apex class using Tooling API in java?

Can I save a new Apex class using Tooling API in java? For Sandbox and Dev Orgs the answer is Yes, using both SOAP and REST flavours of Tooling API. Example here is written in scala, but in java it ...
user avatar
  • 1,360
4 votes
Accepted

Need some help with jquery plugin select2 and VF page

There is a small chance that you are invoking $('select').select2(); before the element is in the DOM; it's usual to use ready to avoid that risk as in the first example in the select2 examples. (...
user avatar
  • 130k
4 votes
Accepted

Salesforce Metadata Api/ Tooling Api to build changesets

Yes its possible. But rather than writing the application drom scratch in another language, consider keeping it on platform! You can use the open source Apex Metadata API and custom metadata to ...
user avatar
  • 394
4 votes
Accepted

SOQL retrieve limited?

lead.setFirstName(sobj[j].getField("FirstName").toString()); The Lead FirstName field is not required. As such, it will return as null via the API if it is not defined. You will need to check if it ...
user avatar

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