Java Category

Apex callout PATCH to Heroku Controller workaround

Setup a method to send Aync call to Heroku, add ‘?_HttpMethod=PATCH’ to the path to notify Heroku it’s a patch request Spring controller checks the RequestParam _HttpMethod to see if it’s a POST or PATCH request

Rate this:

Read More

Salesforce export metadata to csv

Exporting salesforce metadata to csv, iterate through SObject and fields and show Label, API Name, FLS, Custom/Standard field. Output

Rate this:

Read More

Heroku deploy local jar to Maven Dependencies

Sometime a jar is not available via Maven Central Repository and you need to load a jar from your local filesystem. Copy the jar file to a lib directory in your project. Execute the following command via command line Add the following to maven pom.xml

Rate this:

Read More

Create a Salesforce EventBus

Create a new Planform Event Object and give it a name App Metadata (App_Metadata__e) which will also be the name of the topic. Create some fields you that you would like to listen to. In Apex add the following event Build event payload Publish Event to eventBus Now let’s create our event listen to subscript […]

Rate this:

Read More

Implementing Mocking for Apex Tests

Trying to mock a actual database query can be hard. Using the fflib_Mocks jar you can generator Selector Mocks: More info here: https://github.com/financialforcedev/fflib-apex-mocks 1. Create interface class that extends fflib_ISObjectSelector to mock the Selector  2. Create interfacemocks.properties file in root of your project 3. Run java -jar apex-mocks-generator-4.0.0.jar “{path}/src/classes” “{path}/interfacemocks.properties” “fflib_Mocks” “{path}/src/classes” “30.0” to generate mocking […]

Rate this:

Read More

Salesforce Chatter Attaching Files to SObject

There are different ways you can use salesforce to attach a file to an SObject using Chatter. Apex Code Chatter REST Api Some limitations using this is using Blob for version.VersionData = attachment.Body; will run into Apex String length exceeds maximum: 6000000. Chatter Rest API POST https://cs43.salesforce.com/services/data/v35.0/connect/communities/0DB63000000003jGAA/chatter/feed-elements/batch HEADER Authorization         Bearer {sessionToken} Content-Type […]

Rate this:

Read More

Run Spring Boot Scheduler as Heroku Worker

1. Setup Application 2. Setup Scheduler 3. Add Spring Boot dependency 4. Add Procfile 5. Scale Heroku worker 1. Setup Application 2. Setup Scheduler 3. Add Spring Boot dependency 4. Add Procfile 5. Scale Heroku worker

Rate this:

Read More

Microsoft Bing Adwords Java Integration

Step 1: Setup Bing BulkServiceManager Configuration Step 2: Setup Bing Adwords Service

Rate this:

Read More

Apache Camel Kafka Spring Integration

1. Configure Camel Kafka Component 2. Configure Kafka Consume and Producer Route 3. Start Kafka test by adding routes to CamelContext and starting

Rate this:

Read More

Google Adwords Java Integration

Step 1: Create Google AdwordSession configuration 2. Create AdWord Service to export KeyWords, Campaigns, AdGroups and Ads.

Rate this:

Read More