Skip to content

Instantly share code, notes, and snippets.

View rapsacnz's full-sized avatar
🏠
Working from home

Caspar Harmer rapsacnz

🏠
Working from home
View GitHub Profile
[
{
"Type": "Curriculum",
"TitleCurriculum": null,
"MEntryList": null,
"LpSeqList": null,
"LpEntryList": null,
"CuSeqList": null,
"CoEntryList": [
{

To escape the current context and run as the "Automated Process" user (high priviliges), do this:

First define a platform event. For example: Async_Message__e with a paylod and a type.

Then define an AsyncActionUtil class. This will contain a way of inserting these platform events and handling them after insert. The class should contain an insert method:

public static void insertAsyncMessage(String type, String payload) {
  Async_Message__e[] messages = new List<Async_Message__e>{
    new Async_Message__e(Type__c = type, Payload__c = payload)

};