cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vmakker
Frequent Visitor

SubmitForm fails on after first submit

Hi, 

I presume my solution will be related to this but I just implemented a solution suggested here, so I wanted to continue from there since I did not foresee this being an issue. So this is what it is, I have SharePoint list called "Submitted" and a SharePoint list called "Contact" (this list has two columns, Name and Email). "Submitted" has a lookup column that refers to Name column in "Contact" list (called Recipient).

 

"Submitted" has been loaded as a Form on my PowerApp. The app is connected to a Power Automate flow, where clicking on "Submit" creates an entry in the list and sends an email to the recipient selected in the "Recipient" field. I had a disabled text field that loaded the email of the selected recipient. This was working well till the requirement changed and I was asked to add another field for secondary recipients.

Secondary recipients field needs to be a multi-select dropdown, and this is where my problem started. I figured I could add another lookup field in Submitted list and allow for multiple entries. However, when I did this, whenever I tried using the app to make a submission, only the last selection made it to the record. So I gave that up and created a custom card in the form. The custom card has a dropdown that has "Contact.Name" as a source and a disabled text field (called moreEmails). Multiple selections in "Secondary Recipients" create a concatenation of the emails in the disabled text field. Now, then the flow runs, it sends an email to recipients in the "Recipient" and the "Secondary Recipients", and the app navigates to the next page. Problem is, this only runs once. When I come back to the page, I get the error: 

Name isn't valid. 'Title' isn't recognized.

This error appears most commonly when a formula refers to something that no longer exists. For example a control that you have deleted.

Location: moreEmails.Default

 

The default property of the "moreEmails" text field is:

Concat(
   ForAll(
      secondaryRecipients.SelectedItems As aSel,
      LookUp(
         Contact,
         Name = aSel.Title
      ).Email
   ),
   Value,";"
)

 

The OnSelect property is fairly straightforward:

SendEmail.Run(Concatenate(mainRecipient.SelectedText.Email,";",moreEmails.Text);SubmitForm(Form3);Navigate(Screen2,ScreenTransition.Fade);

I am neither deleting, nor moving anything, so I am at a loss for why this may be happening.

 

I would sincerely like to thank @WarrenBelz for getting me this far, hopefully I am one last step away from this being done.

9 REPLIES 9
cha_cha
Resident Rockstar
Resident Rockstar

Hello @vmakker 

 

You have quite a bit of a nesting issue. Can we go back to your original goal and explain to the part where you are still at the 

 

"Secondary recipients field needs to be a multi-select dropdown, and this is where my problem started. I figured I could add another lookup field in Submitted list and allow for multiple entries. However, when I did this, whenever I tried using the app to make a submission, only the last selection made it to the record."

 

stage.

 

Show me the code on that one so we can see how to move forward.


 
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

 
bistek.space   @cha_bistek    @BisTekSpace 

@vmakker 

I will try to guess that

 

Name = aSel.Title

 

 When you go back to the form, there is no value for aSel, so there is no such property of Title for aSel, and so Name cannot be resolved, to lookup the Contact.

 

So you should try to account for secondaryRecipients.SelectedItems being Empty in some cases, and then have nothing for the default in that case, such as 

 

//untested - see if it works though

If
(
    IsEmpty(secondaryRecipients.SelectedItems)
   ,Blank()
   ,Concat(
      ForAll(
         secondaryRecipients.SelectedItems As aSel,
         LookUp(
            Contact,
            Name = aSel.Title
         ).Email
      ),
      Value,";"
   )
)

 

 

See if this helps @vmakker 

WarrenBelz
Super User
Super User

Hi @vmakker ,

I will put in my small contribution as you tagged me - firstly if moreEmails is in a Custom Card (which has no Update property), then it has no bearing on the Form submission process (please confirm this is the case and we can eliminate this as the issue). The next issue is the Table you posted in the original thread

Name (Title)| Email
Person1     | Email1
Person2     | Email2
Person3     | Email3
Person4     | Email4

where I suspect you have renamed the Title field to Name (neither good practices - the renaming and the new field name). If so, try Name instead of Title and see how this works.

moreEmails text field is in a custom card. I think if someone were to make an app with all bad practices, it would be my app.

This was the items attribute for my secondary recipients field: 

Filter(Contact, Title = DataCardValue7.Selected.Value)

 

 

Drrickryp
Super User
Super User

@vmakker 

A student went to a wise man and asked how did he get such good judgement in complicated matters.   The wise man said "From experience."  The student then asked "How do you get experience?".  The wise man said,"From bad judgement." 

Unfortunately the error persists. It works when the app is reloaded, but when I click on "Add Another", I get the error. I am going to try this without lookup columns.

@vmakker What's the formula for when you press "Add Another" is it the formula you gave for OnSelect in original post or is it something else?

"Add Another" goes back to the screen with the form. So the formula is:

ResetForm(Form3);Navigate(Screen1);

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,689)