Spent the whole day trying to find out what is the problem but didn't succeed.
Setup: An org with an Experience Cloud i.e. Community website. The website has a custom registration process which is implemented by the use of a Flow (Community_Self_Reg_Contact) The flow asks for new user's data, checks for existing Contact and Lead and if there are no records with the specified by the use email, creates a new Lead and if there are no already awaiting Approval Requests, submits it to the approval process (Self-Reg Approval Lead).
Here is how the approval process looks like:
Problem: Everything works as expected when I click on Debug in Flow Builder and test, but if I go through the registration process using the same flow from the Experience Cloud website as a guest user, the flow fails giving me this log:
Error element New_Lead (FlowRecordCreate).
This error occurred when the flow tried to create records: CANNOT_EXECUTE_FLOW_TRIGGER: We can't save this record because the “Send Lead for Approval” process failed. Give your Salesforce admin these details. No applicable approval process was found. Error ID: 308525548-113247 (394671088)No applicable approval process was found. Error ID: 308525548-113247 (394671088). You can look up ExceptionCode values in the SOAP API Developer Guide.
Flow Details
Flow API Name: Community_Self_Reg_Contact
Type: Screen Flow
Version: 34
Status: Active
Org: XXXX (XXXXXXXXXXXX)
Flow Interview Details
Interview Label: Community Self-Reg Contact 7/14/2021, 3:51 PM Contact - Lead - entDateTime}
Current User: XXXX Site Guest User (0054W00000DAQqX)
Start time: 7/14/2021, 3:51 PM
Duration: 9 seconds
How the Interview Started
XXXX Site Guest User (0054W00000DAQqX) started the flow interview.
API Version for Running the Flow: 51
Transaction Committed
Any records that the flow was ready to create, update, or delete were committed to the database.
SCREEN: Inquire_Membership
Display Text: first_screen
Value at run time:
Welcome to the XXXX Member Site!
If you want to become a part of our community, fill in the form!
Lightning Component: new_contact_form
Screen component: flowruntime:name
Inputs:
Outputs:
fieldsToDisplayList = firstName,lastName
firstName = asdfsd
label = Name
lastName = fsdf
salutationOptions = Mr.,Mrs.,Ms.
Textbox: new_contact_title
Label: Title
Value at run time: sdfsdf
Textbox: Company_Name
Label: Company Name
Value at run time: sdf
Lightning Component: new_contact_email
Screen component: flowruntime:email
Inputs:
Outputs:
disabled = false
label = Email
placeholder = [email protected]
readonly = false
required = false
value = [email protected]
Selected Navigation Button: NEXT
GET RECORDS: Check_existing_contacts_for_same_email
Find all Contact records where:
Email Equals {!new_contact_email.value} ([email protected])
OR Secondary_Email__c Equals {!new_contact_email.value} ([email protected])
Store the values of these fields in Check_existing_contacts_for_same_email: Id
Result
Failed to find records.
GET RECORDS: Find_Approval_Request_for_Contact
Find all ProcessInstance records where:
TargetObjectId Equals {!Check_existing_contacts_for_same_email.Id} (null)
AND Status Equals Pending
Store the values of these fields in Find_Approval_Request_for_Contact: Id
Result
Failed to find records.
GET RECORDS: Check_existing_lead
Find all Lead records where:
Email Equals {!new_contact_email.value} ([email protected])
Company = {!Company_Name} (sdf)
Email = {!new_contact_email.value} ([email protected])
FirstName = {!new_contact_form.firstName} (asdfsd)
LastName = {!new_contact_form.lastName} (fsdf)
OwnerId = {!$User.Id} (0054W00000DAQqX)
Title = {!new_contact_title} (sdfsdf)
Result
Failed to create record.
Error Occurred: This error occurred when the flow tried to create records: CANNOT_EXECUTE_FLOW_TRIGGER: We can't save this record because the “Send Lead for Approval” process failed. Give your Salesforce admin these details. No applicable approval process was found. Error ID: 308525548-113247 (394671088)No applicable approval process was found. Error ID: 308525548-113247 (394671088). You can look up ExceptionCode values in the
Need some suggestions on what could be causing this behavior.
I thought it might be because of Initial Submitters but even if I set explicitly OwnerId and SubmitterId to be the same $User.Id that doesn't change anything. I also thought about permissions but didn't find anything pertaining to approval processes for the Community Guest User Profile - it has access to create Leads and Contacts though.