apex Category

Apex HttpCalloutMock DML workaround

When doing a callout it has to happen before the DML action. If it happens after the DML it will throw an error or will not execute. Workaround I used is to manually keep track of the mock response, and call the respond method to intercept Http.send when running a test. By checking for Test.isRunningTest() […]

Rate this:

Read More

Apex Dynamic Object Mapping for REST endpoints

Writing rest endpoints in Apex can be hard and exposing Salesforce fields to external application may not make allot of sense as custom fields end with __c and some fields are not writable or systems fields. I have worked on creating a Serializer that could serialize a Salesforce object mapping and translate that back to […]

Rate this:

Read More

Apex callout to RabbitMQ Queue

Create AMQP HTTPRequest calling POST /api/exchanges/{username}/{exchangeName}/publish WebCustomSettings are custom settings in Salesforce the values are the following: AMQP_Url__c: https://jellyfish.rmq.cloudamqp.com AMQP_Credentials__c: xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx (username:password) Setup AMQP headers Serialize AMQP Request JSON Callout RabbitMQ

Rate this:

Read More

Apex Regex Validation Factory

Validation Factory Validation Factory Test Class

Rate this:

Read More

Apex Get Enum from String

Get Enum from String Test Class

Rate this:

Read More

Apex Advanced Selector Queries

Sub Queries Pagination with Ordering Aggregate Query

Rate this:

Read More