Playground

Welcome! This tool makes it easy to learn and experiment with scripts, directly from your browser. The API documentation integrates with this playground. Press the Try buttons or copy/paste snippets directly. All scripts run in Salesforce Flow:

 

 
Flow
Start
End

How to use the playground

   Text {!var} Text {!secret_mdt}
   Text {!weather} Text {!$Flow.InterviewGuid}
   Date {!$Flow.CurrentDate} Datetime {!$Flow.InterviewStartTime}
   Record {!$Record} Record {!$Record__Prior}
   Number {!sales} Number {!costs}
   Number {!age} Number {!staff}

 

Examples

# Dynamic map keys
$map = {'lead key': '00Q'}
Log $map['lead key'] # not like this
Log $map.get('lead key') # like thisTry
# Traverse nested maps and allow null values
$Task = New-Task; $map = {exists: {child: 'Call'}}
try {$Task.Subject = $map.exists.child} catch {} # works
try {$Task.Subject = $map.notexists.child} catch {} # ignored
return $TaskTry
# Escapes and newlines in text
Log 'Single quoted \n text as-is'
Log "Double quoted \n supports escapes"Try
# SOQL query :bind
$companies = ['ACME', 'Initech']
$records = Query-Records 'SELECT Id, Name
FROM Account WHERE Name IN :companies'
return $recordsTry
# Debug a fake inbound webhook
$Webhook.request = `{"order":{"id":123}}`
$Webhook.requestUri = '/Streams/MyWebhook'
$Webhook.requestHeaders = {Content-Type: 'application/json'}
$request = Json-Decode $Webhook.request
Log $request.order.idTry
# Loop over JSON items
$items = Json-Decode `[{"price":10},{"price":20},{"price":30}]`
foreach ($item in $items) {Log $item.price}Try
# List items
$item = $items.0 # like this
$item = $items[0] # not this
# Template strings
$text = `Hello $name` # like this
$text = 'Hello $name' # not this
$text = "Hello $name" # not this
# Native JSON
$map  =  {"num": 11}  # map value can use dot operator
$text = '{"num": 22}' # JSON text must be decoded first
return $map.num + (Json-Decode $text).num # Gives 33Try
# Save a webhook
$Task = New-Task
$Task.Subject = 'Webhook'
$Task.Description = Json-Encode $Webhook
return $TaskTry
# Debug an HTTP request
$url = 'httpbin.org/post'
$headers = {Content-Type: 'text/xml'}
$payload = '<xml>Example request body</xml>'
$Http = Http-Post $url $headers $payload
Log $Http.headers $Http.status $Http.bodyTry
# Date formats
$dt = {!$Flow.InterviewStartTime}
return $dt.format('dd/MM/yyyy h:mm a')Try
# How to use parameterised return
$Lead = New-Lead -Company 'ACME'
$Notes = [New-Note -ParentId '00Q...']
$Notes.add(New-Note -ParentId '00Q...')
return -record $Lead -records $NotesTry

Capabilities

Benefits

We hope you find the playground useful, and we sincerely welcome feedback: Contact Us »

 

Getting started with Streamscript
Install from the Salesforce AppExchange
Package install link: /packaging/installPackage.apexp?p0=04tGA000005ZGcU