Skip to content

Instantly share code, notes, and snippets.

@zachboyd
zachboyd / AWSSubscriptionClient.ts
Last active September 22, 2022 15:09
Appsync Subscription support for subscriptions-transport-ws
import { uniqBy } from 'lodash';
import { ClientOptions, SubscriptionClient } from 'subscriptions-transport-ws';
export class AWSSubscriptionClient extends SubscriptionClient {
constructor(
url: string,
options?: ClientOptions,
webSocketImpl?: any,
webSocketProtocols?: string | string[]
) {
@zachboyd
zachboyd / sfdc-follow-record
Created November 14, 2016 20:15
Inserts EntitySubscription record for user to follow a record. Helpful when you need people to automatically follow a record without logging in on behalf of them.
// ID of record to follow
String recordId = '<my record id here>';
// Create list of user ids
List<Id> userIdList = new List<Id>();
// add ID of all users to list
userIdList.add( '<user id here>' );
List<EntitySubscription> entitySubList = new List<EntitySubscription>();
@zachboyd
zachboyd / sfmc-update-sf-contact.amp
Last active October 11, 2016 17:53
Salesforce Marketing Cloud - Update Contact with AMP example
<div>
%%[
var @Id, @contactRecord, @limitRow, @firstName, @lastName
set @Id = RequestParameter('id')
set @firstName = RequestParameter('firstName')
if RequestParameter("submitted") == "submitted" then