Skip to content

Instantly share code, notes, and snippets.

@alexed1
Created September 17, 2017 17:15
Show Gist options
  • Save alexed1/8b4f8d6528817bb74e53d60dc60c35cf to your computer and use it in GitHub Desktop.
Save alexed1/8b4f8d6528817bb74e53d60dc60c35cf to your computer and use it in GitHub Desktop.
Simple Process that Listens to Event and Posts to Chatter
{
"fullName": "without_flow_launch-2",
"actionCalls": [{
"name": "eventContextErrorEmail",
"label": "Context Error Email",
"locationX": "0",
"locationY": "0",
"actionName": "emailSimple",
"actionType": "emailSimple",
"inputParameters": [{
"name": "emailSubject",
"value": {
"stringValue": "Salesforce without 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 without 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",
"inputParameters": [{
"name": "text",
"value": {
"stringValue": "process alextest2 running on jeffnix"
}
}, {
"name": "type",
"value": {
"stringValue": "GROUP"
}
}, {
"name": "subjectNameOrId",
"value": {
"stringValue": "0F99A00000003aHSAQ"
}
}]
}],
"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": "without_flow_launch-2_InterviewLabel",
"label": "without 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 without 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 without 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