Skip to content

Instantly share code, notes, and snippets.

View ehsky's full-sized avatar

Erlend Hansen ehsky

  • Stretch Engage
  • Norway
View GitHub Profile
@ehsky
ehsky / _DEMO_FlowVisibilityNavigator.md
Last active November 14, 2024 18:40
The VisibilityObserver component is designed to work within Salesforce Flows to detect when it becomes visible on the screen. When this component appears in or exits the user’s view, it can automatically move the Flow forward, backward, pause, or finish, based on the settings chosen.

Overview

The VisibilityObserver component is designed to work within Salesforce Flows to detect when it becomes visible on the screen. When this component appears in or exits the user’s view, it can automatically move the Flow forward, backward, pause, or finish, based on the settings chosen.

Key Features

  • Viewport Detection: Tracks when the component enters or leaves the visible area of the screen.
  • Flow Navigation: Automatically triggers navigation actions within the Flow (such as “Next” or “Back”) when the component comes into view.
  • Customizable Check Interval: Allows you to control how often the component checks its visibility on the screen.
@ehsky
ehsky / example.ics
Last active August 14, 2023 19:16
Testing ICS
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Salesforce Marketing Cloud instance of %%member_busname%%
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Central Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
@ehsky
ehsky / MS Teams - Automation Monitoring-v2.json
Created July 28, 2023 12:36
Marketing Cloud Package: Automation Monitoring with Microsoft Teams integration
{
"events": [
{
"data": {
"schema": "22g3pL899yc5TkDjhghSCg",
"payload": {
"FlowApiName__c": "Account_update_address_details_on_open_quotes",
"CreatedById": "0050O000007jEAMQA2",
"RecordId__c": "0013Y00002wZI2MQAW",
"CreatedDate": "2023-06-27T15:28:33.195Z"
@ehsky
ehsky / homePage_twoRegionLargeLeft.cmp
Last active January 23, 2023 12:31
Custom Salesforce Home Page layout desktop form factor. Section 1: left 80% right 20%. Section 2: left and right 50%
<aura:component implements="lightning:homeTemplate"
description="Home Page layout. Section 1: left 80% right 20%. Section 2: left and right 50%">
<aura:attribute name="leftTop" type="Aura.Component[]" />
<aura:attribute name="rightTop" type="Aura.Component[]" />
<aura:attribute name="leftBottom" type="Aura.Component[]" />
<aura:attribute name="rightBottom" type="Aura.Component[]" />
<div>
<lightning:layout>
<lightning:layoutItem size="10" class="slds-m-right_small"> {!v.leftTop}
</lightning:layoutItem>
@ehsky
ehsky / _DEMO_CustomFileImportWithDynamicInteractions.md
Last active January 31, 2023 12:39
Simplified example of how to implement the lightning-input of type file. To retrieve the content of a file to be sendt to an apex method.

How to use

This is an example implementation of the <lightning-input type="file"></lightning-input> that is a less restricive alternative to the LWC component lightning-file-upload.
This component can be used in a Screen Flow, Lightning App Page or a Lightning Record page.

When using it on a lightning page there is added a dynamic event that can be configured by an admin in the Lightning App Builder.

Demo of dynamic interactions

Screen.Recording.2023-01-17.at.00.16.08.mov
@ehsky
ehsky / Dynamic_FromEmail.amp
Last active January 11, 2023 08:51
Dynamic Sender Profile With AmpScript based on Contact and Lead owner in Marketing Cloud
%%[
var @SK,@lookupde,@lookupvalue, @Owner, @OwnerEmail,@StandardEmail
set @sk = AttributeValue("_subscriberkey")
set @ContactStart = "003"
set @StandardEmail = "yourFallback@emailDomain.com"
IF INDEXOF(@sk,@ContactStart) > 0 THEN
SET @lookupDE = "ent.Contact_0"
SET @lookupvalue = "ContactID"
@ehsky
ehsky / GenerateCSVfile.apex
Created December 22, 2022 11:50
Example Apex script to generate a CSV file based on a List<sObject>
/**
* Main method that will be called when the script is run
*/
void start() {
/// Here you input your own logic can code to generate the recordList.
// Example usage:
List<Contact> recordList = [SELECT Id, FirstName, LastName FROM Contact];
List<String> csvHeaders = new List<String>{ 'Id', 'FirstName', 'LastName' }
@ehsky
ehsky / GenerateMarketingCloudKeys.html
Last active December 14, 2022 10:22
Generates Symmetric, Salt and initialisation vector used in Marketing Cloud Key Management
<script runat="server">
Platform.Load("Core","1.1.1");
try{
function createPassword( len ) {
var length = (len)?(len):(10);
var string = "abcdefghijklmnopqrstuvwxyz";
//to upper
var numeric = '0123456789';
var punctuation = '!#$^&%@*';
var password = "";
@ehsky
ehsky / CountryFlag__c
Last active November 16, 2022 12:48
Salesforce formula field to output the flag of the accounts
// Option 1: Use on plain text filds
IMAGE("https://countryflagsapi.com/png/"& ShippingCountry ,"Country flag",20,30)
/// Option 2: Custom picklist field with country iso code as values
IMAGE("https://countryflagsapi.com/png/"& text(Country_Code__c),"Country flag",20,30)
@ehsky
ehsky / CustomPreferenceCenter
Created January 26, 2022 15:35
A Custom preference center that is using 2 custom object connected to the individual object. This can be adapted to use the consent management model from salesforce instead of custom objects
<!-- CUSTOMER_NAME Profile center by Erlend Stretch Norge -->
<link href="styles" rel="stylesheet"> <!-- Import CUSTOMER_NAME stylesheet -->
<link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
<style>
body {
font-family: "Ubuntu" Fallback, sans-serif;
color: #161225;
}
.tooltip {
position: relative;