Hot answers tagged

21 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 ...
Daniel Ballinger's 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:\...
Sander de Jong's 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 ...
ipavlic's user avatar
  • 3,684
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 ...
Santanu Boral's user avatar
8 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'};
flameless's user avatar
7 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 ...
Markus Dang - formerly Slabina's user avatar
7 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 ...
ncv's user avatar
  • 418
7 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....
David Reed's user avatar
  • 92.1k
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 ...
pnoytechie's user avatar
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 ...
Daniel Ballinger's 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 ...
sfdcfox's user avatar
  • 481k
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 ...
manjit5190's user avatar
  • 7,973
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....
Frederik Witte's 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 ...
Keith C's user avatar
  • 135k
5 votes
Accepted

JSONGenerator issue

To remove the backslash you have to write the blob value of the JSON String into the body directly in the RestContext. You will have to change the return type of your method from String to void. @...
Saroj Bera's user avatar
  • 14.6k
5 votes
Accepted

Convert code snipet from Java to Apex

Yep, Http basic auth uses base64. The Base64.encodeToString in the Java snippet should've also given that away. Given what you've shown so far, your Authorization header is incorrect. If you inspect ...
Derek F's user avatar
  • 59.4k
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. (...
Keith C's user avatar
  • 135k
4 votes

Salesforce Metadata Api/ Tooling Api to build changesets

You can use salesforce Metadata API for this purpose . If you are familiar with ANT tool ,you will find that there is force.com migration tool in SFDC which uses ANT commands to help extract metadata ...
Mohith Shrivastava's user avatar
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 ...
frup42's user avatar
  • 414
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 ...
Daniel Ballinger's user avatar
4 votes
Accepted

java and apex output different crypto generateDigest SHA-512 method in apex and java logic not same

Both languages are working fine. You are decoding them with wrong base. Apex method is encoding blob as Base 64 and Java method is encoding it in Base 16. When you convert it in base 16 it output hex ...
Ashwani's user avatar
  • 22.6k
4 votes

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

Maybe will be useful for anyone in future. I got this error in another case. The triggered send was configured only to Add Subscribers to All Subscribers, without Update checkbox. And the request ...
Polina Drobot's user avatar
4 votes

Need Help on Encryption and decryption logic

The Crypto class in Apex only supports CBC (Cipher Block Chaining) mode for AES, so based on that alone I'd say that it's not possible to port this exact code to Apex (unless you implement your own ...
Derek F's user avatar
  • 59.4k
4 votes

Lombok for Salesforce Apex

Illuminated Cloud (paid plugin for IntelliJ) has live templates for Apex and Lightning Web Components to help save time. Likewise, you can create your own live templates for IntelliJ if desired. There'...
Kris Goncalves's user avatar
4 votes

Get values from nested JSON dictionaries in Apex

I'm the author of the libshare JsonMapper is a utility class I wrote as part of libshare opensource package. This makes it easy to read raw json. For ex., new JsonMapper(jsonStr).getString('values[0]....
metasync's user avatar
  • 1,772
3 votes

Need some help with jquery plugin select2 and VF page

Try this as your javascript code, it is better to run your JS code in your document.ready function that just dropping it in the script tag. $( document ).ready(function() { $('select').select2(); })...
Sebastian Kessel's user avatar
3 votes

Database.Query give wrong result

The query is fine, you've given the table Lead an alias 'eeretsavd'. This means you can use that name later on in the query if you want to name columns from that table. See page 2 of chapter 1 (...
user254875486's user avatar
3 votes
Accepted

Java - Metadata Api readMetadata() not returning corrrect info

Based on the documentation on readMetadata(), it does not seem like wildcard selection is possible, since the limit on returned results is 10. Arguments Name fullNames Type string[] ...
Adrian Larson's user avatar
  • 149k
3 votes
Accepted

How to communicate with Salesforce without WSDL?

It sounds like you are using the Enterprise WSDL. This is a strongly typed WSDL that is bound to the Salesforce configuration/schema at the time it was generated. On the plus side, it gives you easy ...
Daniel Ballinger's user avatar
3 votes

How to convert "2016-11-08T13:04:16.5260175Z" this into apex datetime like "11/8/2016 1:04 PM"

I think that the most reliable method is to use the JSON.deserialize method. This accounts for time zones etc and is invoked like this: DateTime result = (DateTime)JSON.deserialize('"' + '2016-11-...
Aidan's user avatar
  • 13.5k

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