Skip to content

Instantly share code, notes, and snippets.

@alexed1
Created September 17, 2017 17:22
Show Gist options
  • Save alexed1/2128b75bce1d58b1bb803ae198bf1627 to your computer and use it in GitHub Desktop.
Save alexed1/2128b75bce1d58b1bb803ae198bf1627 to your computer and use it in GitHub Desktop.
That Same Process, with a Launch Flow
{
"fullName": "with_flow_launch-1",
"actionCalls": [{
"name": "eventContextErrorEmail",
"label": "Context Error Email",
"locationX": "0",
"locationY": "0",
"actionName": "emailSimple",
"actionType": "emailSimple",
"inputParameters": [{
"name": "emailSubject",
"value": {
"stringValue": "Salesforce with_flow_launch process didn't start: No matching records found"
}
}, {
"name": "emailBody",
"value": {
"elementReference": "noRecordsFoundTextTemplate"
}
}, {
"name": "emailAddresses",
"value": {
"stringValue": "aedelstein@salesforce.com"
}
}]
}, {
"name": "eventContextMoreEmail",
"label": "Context Error Email",
"locationX": "0",
"locationY": "0",
"actionName": "emailSimple",
"actionType": "emailSimple",
"inputParameters": [{
"name": "emailSubject",
"value": {
"stringValue": "Salesforce with_flow_launch process didn't start: Multiple matching records found"
}
}, {
"name": "emailBody",
"value": {
"elementReference": "multipleRecordsFoundTextTemplate"
}
}, {
"name": "emailAddresses",
"value": {
"stringValue": "aedelstein@salesforce.com"
}
}]
}, {
"processMetadataValues": [{
"name": "postTarget",
"value": {
"stringValue": "group_edelstein"
}
}, {
"name": "textJson",
"value": {
"stringValue": "{\"mentions\":[],\"message\":\"process alextest2 running on jeffnix\"}"
}
}],
"name": "myRule_1_A1",
"label": "log to console",
"locationX": "100",
"locationY": "200",
"actionName": "chatterPost",
"actionType": "chatterPost",
"connector": {
"targetReference": "myRule_1_A2"
},
"inputParameters": [{
"name": "text",
"value": {
"stringValue": "process alextest2 running on jeffnix"
}
}, {
"name": "type",
"value": {
"stringValue": "GROUP"
}
}, {
"name": "subjectNameOrId",
"value": {
"stringValue": "0F99A00000003aHSAQ"
}
}]
}, {
"processMetadataValues": [{
"name": "ActionCallType",
"value": {
"stringValue": "flow"
}
}, {
"name": "flowSelection",
"value": {
"stringValue": "Flow Launched Stub"
}
}],
"name": "myRule_1_A2",
"label": "Launch the Stub Flow",
"locationX": "100",
"locationY": "300",
"actionName": "Flow_Launched_Stub",
"actionType": "flow"
}],
"assignments": {
"name": "RecordCountAssignment",
"label": "RecordCountAssignment",
"locationX": "0",
"locationY": "0",
"assignmentItems": [{
"assignToReference": "myVariable_event_record_count",
"operator": "Add",
"value": {
"numberValue": "1.0"
}
}, {
"assignToReference": "myVariable_event_context",
"operator": "Assign",
"value": {
"elementReference": "myVariable_event_current_record"
}
}],
"connector": {
"targetReference": "eventContextCheckLoop"
}
},
"decisions": [{
"name": "eventContextCheckDecision",
"label": "ContextCheckDecision",
"locationX": "0",
"locationY": "0",
"defaultConnector": {
"targetReference": "myDecision"
},
"defaultConnectorLabel": "default",
"rules": [{
"name": "eventContextCheckRule",
"conditionLogic": "and",
"conditions": {
"leftValueReference": "myVariable_event_record_count",
"operator": "EqualTo",
"rightValue": {
"numberValue": "0.0"
}
},
"connector": {
"targetReference": "eventContextErrorEmail"
},
"label": "Context Check Decision - Is Zero"
}, {
"name": "eventContextGtOneCheckRule",
"conditionLogic": "and",
"conditions": {
"leftValueReference": "myVariable_event_record_count",
"operator": "GreaterThan",
"rightValue": {
"numberValue": "1.0"
}
},
"connector": {
"targetReference": "eventContextMoreEmail"
},
"label": "Context Check Decision - Greater than One"
}]
}, {
"processMetadataValues": {
"name": "index",
"value": {
"numberValue": "0.0"
}
},
"name": "myDecision",
"label": "myDecision",
"locationX": "50",
"locationY": "0",
"defaultConnectorLabel": "default",
"rules": {
"name": "myRule_1",
"conditionLogic": "and",
"conditions": {
"leftValueReference": "formula_myRule_1",
"operator": "EqualTo",
"rightValue": {
"booleanValue": "true"
}
},
"connector": {
"targetReference": "myRule_1_A1"
},
"label": "passthrough"
}
}],
"formulas": [{
"name": "formula_myRule_1",
"dataType": "Boolean",
"expression": "true"
}, {
"name": "OrganizationName",
"dataType": "String",
"expression": "{!$Organization.Name}"
}],
"interviewLabel": "with_flow_launch-1_InterviewLabel",
"label": "with_flow_launch",
"loops": {
"name": "eventContextCheckLoop",
"label": "ContextCheckLoop",
"locationX": "0",
"locationY": "0",
"assignNextValueToReference": "myVariable_event_current_record",
"collectionReference": "myVariable_event_context_collection",
"iterationOrder": "Asc",
"nextValueConnector": {
"targetReference": "RecordCountAssignment"
},
"noMoreValuesConnector": {
"targetReference": "eventContextCheckDecision"
}
},
"processMetadataValues": [{
"name": "EventType",
"value": {
"stringValue": "Recommendation_Request__e"
}
}, {
"name": "ObjectType",
"value": {
"stringValue": "Contact"
}
}],
"processType": "CustomEvent",
"recordLookups": {
"name": "myEventContextRecordLookup",
"label": "myEventContextRecordLookup",
"locationX": "0",
"locationY": "0",
"assignNullValuesIfNoRecordsFound": "false",
"connector": {
"targetReference": "eventContextCheckLoop"
},
"filters": {
"processMetadataValues": [{
"name": "implicit",
"value": {
"booleanValue": "false"
}
}, {
"name": "inputDataType",
"value": {
"stringValue": "String"
}
}, {
"name": "leftHandSideLabel",
"value": {
"stringValue": "Last Name"
}
}, {
"name": "leftHandSideReferenceTo",
"value": {
"stringValue": ""
}
}, {
"name": "leftHandSideType",
"value": {
"stringValue": "String"
}
}, {
"name": "operatorDataType",
"value": {
"stringValue": "String"
}
}, {
"name": "rightHandSideType",
"value": {
"stringValue": "String"
}
}],
"field": "LastName",
"operator": "EqualTo",
"value": {
"stringValue": "foo"
}
},
"object": "Contact",
"outputReference": "myVariable_event_context_collection"
},
"startElementReference": "myEventContextRecordLookup",
"textTemplates": [{
"description": "text template for when multiple records are records found",
"name": "multipleRecordsFoundTextTemplate",
"text": "Hello {!OrganizationName} Admin, \n\nThe with_flow_launch process is configured to start when a Recommendation Request platform event message occurs. A Recommendation Request message occurred, but the process didn't start because multiple records in your org match the values specified in the process's Object node.\n\n\n\nTo fix this issue, adjust the matching filters in the process's Object node.\n\nThank you, \nSalesforce Process Automation"
}, {
"description": "text template for no records found",
"name": "noRecordsFoundTextTemplate",
"text": "Hello {!OrganizationName} Admin, \n\nThe with_flow_launch process is configured to start when a Recommendation Request platform event message occurs. A Recommendation Request message occurred, but the process didn't start because no records in your org match the values specified in the process's Object node.\n\n\n\nTo fix this issue, adjust the matching filters in the process's Object node.\n\nThank you, \nSalesforce Process Automation"
}],
"variables": [{
"name": "myVariable_event_context",
"dataType": "SObject",
"isCollection": "false",
"isInput": "true",
"isOutput": "true",
"objectType": "Contact"
}, {
"name": "myVariable_event_context_collection",
"dataType": "SObject",
"isCollection": "true",
"isInput": "true",
"isOutput": "true",
"objectType": "Contact"
}, {
"name": "myVariable_event_current_record",
"dataType": "SObject",
"isCollection": "false",
"isInput": "true",
"isOutput": "true",
"objectType": "Contact"
}, {
"name": "myVariable_event_record_count",
"dataType": "Number",
"isCollection": "false",
"isInput": "true",
"isOutput": "true",
"scale": "2",
"value": {
"numberValue": "0.0"
}
}, {
"name": "myVariable_myEvent",
"dataType": "SObject",
"isCollection": "false",
"isInput": "true",
"isOutput": "false",
"objectType": "Recommendation_Request__e"
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment