function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brian KesslerBrian Kessler 

How can I debug a process or flow? Having trouble to create the automate pre-workshop...

Hi!

I'm currently working my way through Automate Pre-Workshop Tasks with Flow.

Evidently, either the Flow or Process Builder allowed me to enter some corrupt data into the GUI.
(Wouldn't it be nice to look at code in an IDE that would tell me this as I did it? ... but that's not exactly what I want to ask.)

When I try to test the Process/Flow combination manually, saving fails with the following output:
 
Workflow Action Failed to Trigger Flow
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3010Y000000H8Et. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help. 

Click here to return to the previous page.

Alternatively, even knowing the step couldn't (or at least shouldn't) possibly pass verification, submission to trailhead results in:
 
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3010Y000000H8Et. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []

Googling such errors yields no results (or at least nothing fruitful).

Can you please help me determine what I did wrong?
Also, if there are any tips for diagnosing and resolving such issues, I'd be glad to know them before such errors happen when I'm doing this for employers/clients.
(Though I'd much rather be doing this with Apex triggers and well-coded trigger handlers!  ... and wouldn't it be nice if all these processes, flows, etc. transpiled to Apex...)


 
Best Answer chosen by Brian Kessler
Brian KesslerBrian Kessler
This IS an Answer

Actually three of them:

So, the main advice I have to anyone walking in my footsteps:
1. Check for the emails which (hopefully) will be sent to your email address (you might want to set up a dedicated email address to receive them).
2. Read them carefully.

That said, I discovered that I was suffering from three problems:

1. The sample Chatter Action given in Automate Pre-Workshop Tasks with Process Builder (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_process_builder) : Add a Chatter Action is BAD.

  Be sure to use Instructor__c, not Instructor__r.

2. The Instructor field we created in Get Started (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_get_started) is not required (which makes sense because you might not want to require the Instructor for other types of campaigns... though it is really questionable why you'd want to use a Campaign instead of a custom object).

If you neglect to enter this field when the type is set to "Dev Class", the Instructor's names will have null values, which causes the flow to crash.

Consider implementing a validation rule to ensure that if the Campaign's type is Dev Class, the Instructor is not blank.

(Also, it seems like a bug in Flow if it will crash because a template finds a null value in an optional field... It might make sense to crash business logic for unexpected nulls, but not templates!)

3. Back in the Flow created for Automate Pre-Workshop Tasks with Flow (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_flow), : Use the Contact Values to Populate the Campaign Members Collection : Step 2,  I had a well hidden typo.

Exactly as displayed in the illustration, the value for my second variable appeared {!CampaignMemberRecord.C

Well, as you can see, that's not the complete value.  If you read carefully, youd know the value should read {!CampaignMemberRecord.CampaignId} ... but I accidently entered {!CampaignMemberRecord.Contact}

While the typo was obviously mine, this reflects at least three serious issues with the Flow UX:
1. The interface obscures important information, even while wasting screen real estate.
2. The interface won't let me simply type or copy/paste the values I want into the field, but rather I must go through tedious selection process.
3. While it should havebeen evident tha a ContactId can never equal a CampaignId, the process did not provide this validation.








 

All Answers

Brian KesslerBrian Kessler
Additional Information (Not an Answer): Emails consequent to each of the above attempts:

Error Occurred During Flow "Add_Chapter_TAs_to_Class_Session": This error occurred when the flow tried to ...
 
Error element Create_Campaign_Members_for_TAs (FlowRecordCreate).
This error occurred when the flow tried to create records: FIELD_INTEGRITY_EXCEPTION: Contact ID: id value of incorrect type: 7010Y000000cJmXQAU. For details, see API Exceptions.
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: Add_Chapter_TAs_to_Class_Session
Type: Autolaunched Flow
Version: 1
Status: Active
Flow Interview Details
Interview Label: Add Chapter TAs to Class Session 06/02/2017 21:24
Current User: Brian Kessler (0050Y000000e94c)
Start time: 06/02/2017 21:24
Duration: 0 seconds
How the Interview Started
Brian Kessler (0050Y000000e94c) started the flow interview.
Some of this flow's variables were set when the interview started.
CampaignIDFromPB = 7010Y000000cJmXQAU
AccountIDFromPB = 0010Y00000E7yybQAB
FAST LOOKUP: Find_Chapter_TAs
Find all Contact records where:
AccountId Equals {!AccountIDFromPB} (0010Y00000E7yybQAB)
Assign those records to {!ChapterTAContacts}.
Save these field values in the variable: Id
Result
Successfully found records.

LOOP: Loop_through_contacts
Loop Through: [0030Y00000AkFdBQAV,0030Y00000AkFdAQAV]
Iteration: 0
Current value of {!ContactRecord}: 0030Y00000AkFdBQAV
ASSIGNMENT: Map_Contact_ID_to_Campaign_Member
{!CampaignMemberRecord.ContactId} Equals {!ContactRecord.Id}
{!CampaignMemberRecord.ContactId} Equals {!CampaignIDFromPB}
Result
{!CampaignMemberRecord.ContactId} = "7010Y000000cJmXQAU"
{!CampaignMemberRecord.ContactId} = "7010Y000000cJmXQAU"
ASSIGNMENT: populate_the_Campaign_Member_collection
{!TACampaignMembers} Add {!CampaignMemberRecord}
Result
{!TACampaignMembers} = "[]"
LOOP: Loop_through_contacts
Loop Through: [0030Y00000AkFdBQAV,0030Y00000AkFdAQAV]
Iteration: 1
Current value of {!ContactRecord}: 0030Y00000AkFdAQAV
ASSIGNMENT: Map_Contact_ID_to_Campaign_Member
{!CampaignMemberRecord.ContactId} Equals {!ContactRecord.Id}
{!CampaignMemberRecord.ContactId} Equals {!CampaignIDFromPB}
Result
{!CampaignMemberRecord.ContactId} = "7010Y000000cJmXQAU"
{!CampaignMemberRecord.ContactId} = "7010Y000000cJmXQAU"
ASSIGNMENT: populate_the_Campaign_Member_collection
{!TACampaignMembers} Add {!CampaignMemberRecord}
Result
{!TACampaignMembers} = "[,]"
LOOP: Loop_through_contacts
End Loop.
FAST CREATE: Create_Campaign_Members_for_TAs
Create CampaignMember records using the values that are stored in {!TACampaignMembers}.
Variable Values
[ContactId=7010Y000000cJmXQAU]
[ContactId=7010Y000000cJmXQAU]
Result
Failed to create records.

Error Occurred: This error occurred when the flow tried to create records: FIELD_INTEGRITY_EXCEPTION: Contact ID: id value of incorrect type: 7010Y000000cJmXQAU. For details, see API Exceptions.
Salesforce Error ID: 903305555-46094 (1894192610)

Error Occurred During Flow "New_Class_Sessions": An error occurred when executing a flow interview.
Error element myRule_1_A2 (FlowActionCall).
An error occurred when executing a flow interview. 
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: New_Class_Sessions
Type: Workflow
Version: 2
Status: Active
Flow Interview Details
Interview Label: New_Class_Sessions-2_InterviewLabel
Current User: Brian Kessler (0050Y000000e94c)
Start time: 06/02/2017 21:24
Duration: 0 seconds
How the Interview Started
Brian Kessler (0050Y000000e94c) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = 7010Y000000cJmXQAU
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "06/02/2017 21:24"
DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!myVariable_current.Type} (Dev Class) Equals Dev Class
Logic: All conditions must be true (AND)
POST TO CHATTER: myRule_1_A1
Inputs:
text = HELP WANTED! I'm looking for Teaching Assistant volunteers for a {!myVariable_current.Name} class taught by {!myVariable_current.Instructor__r.FirstName} {!myVariable_current.Instructor__r.LastName} on {!myVariable_current.StartDate}! Please email me at {!myVariable_current.Owner.Email} if you are interested. (HELP WANTED! I'm looking for Teaching Assistant volunteers for a Trailhead is #Superduperawesome! class taught by Mary Jones on 06 February 2017! Please email me at kessler.bm@gmail.com if you are interested. )
type = GROUP
subjectNameOrId = 0F90Y000000PZmlSAG
Outputs:
None.

ADD_CHAPTER_TAS_TO_CLASS_SESSION (FLOWS): myRule_1_A2
Inputs:
AccountIDFromPB = {!myVariable_current.Chapter__c} (0010Y00000E7yybQAB)
CampaignIDFromPB = {!myVariable_current.Id} (7010Y000000cJmXQAU)
Error Occurred: An error occurred when executing a flow interview. 
Salesforce Error ID: 903305555-46095 (772086563)

 
Brian KesslerBrian Kessler
This IS an Answer

Actually three of them:

So, the main advice I have to anyone walking in my footsteps:
1. Check for the emails which (hopefully) will be sent to your email address (you might want to set up a dedicated email address to receive them).
2. Read them carefully.

That said, I discovered that I was suffering from three problems:

1. The sample Chatter Action given in Automate Pre-Workshop Tasks with Process Builder (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_process_builder) : Add a Chatter Action is BAD.

  Be sure to use Instructor__c, not Instructor__r.

2. The Instructor field we created in Get Started (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_get_started) is not required (which makes sense because you might not want to require the Instructor for other types of campaigns... though it is really questionable why you'd want to use a Campaign instead of a custom object).

If you neglect to enter this field when the type is set to "Dev Class", the Instructor's names will have null values, which causes the flow to crash.

Consider implementing a validation rule to ensure that if the Campaign's type is Dev Class, the Instructor is not blank.

(Also, it seems like a bug in Flow if it will crash because a template finds a null value in an optional field... It might make sense to crash business logic for unexpected nulls, but not templates!)

3. Back in the Flow created for Automate Pre-Workshop Tasks with Flow (https://trailhead.salesforce.com/project/workshop_mgmt/workshop_mgmt_flow), : Use the Contact Values to Populate the Campaign Members Collection : Step 2,  I had a well hidden typo.

Exactly as displayed in the illustration, the value for my second variable appeared {!CampaignMemberRecord.C

Well, as you can see, that's not the complete value.  If you read carefully, youd know the value should read {!CampaignMemberRecord.CampaignId} ... but I accidently entered {!CampaignMemberRecord.Contact}

While the typo was obviously mine, this reflects at least three serious issues with the Flow UX:
1. The interface obscures important information, even while wasting screen real estate.
2. The interface won't let me simply type or copy/paste the values I want into the field, but rather I must go through tedious selection process.
3. While it should havebeen evident tha a ContactId can never equal a CampaignId, the process did not provide this validation.








 
This was selected as the best answer