web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Powerapps Custom Form ...
Power Apps
Answered

Powerapps Custom Form -Cascaded Fields Not Updating to SharePoint List

(0) ShareShare
ReportReport
Posted on by 28

Hello Everyone,

Sorry, I'm new to this and have been searching for days now with no luck. I may not be understanding the Patch function or maybe I'm completely messing things up, but I'm hoping for some help or insight.

 

  • I have SP List 1 that has two columns titled Main Category and Sub Category. They are both setup as Single Line of Text, at the moment.
  • Then, I have SP List 2. It also has two columns titled Main Category and Sub Category and are also setup as Single Line of Text.
  • I created the cascaded dropdowns on my SharePointForm1 custom form, and that works as expected, they are also titled Main Category and Sub Category. So when I selected Option 1 in Main Category I get only the Sub Category options related to Option 1. 
  • Both dropdowns are standard dropdowns, not combo dropdowns

The problem I'm having is, when I fill out the form, and I select the Main Cat and the Sub Cat then I submit the form, everything populates into SP List 1 but those two categories. I figured it's related to the fact that those two categories are pulling from SP List 2, so they wont populate SP List 1. I guess my question is, am I even on the right path with this being a Patch function issue? Is that what I need to do to get the options from SP List 2 to populate into SP List 1? Or am I just completely lost? If it's not a Patch issue, where should I look to get this issue resolved? 

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Dll10685 What do you have in the Items property for these 2 dropdowns and the Update property for the 2 datacards that hold these 2 dropdowns?

  • Dll10685 Profile Picture
    28 on at

    So for Items:

    Main Category I have Items = Distinct('SP List 2', Title)

    Sub Category I have Items = Filter('SP List 2', 'Main Category' = Dropdown1.Selected.Result) - Dropdown1 being the dropdown box for Main Category.

    And for Update:

    Main Category is Update = {Value: Dropdown1.Selected.Result}

    Sub Category is Update = {Value: Dropdown3.Selected.Value} -Dropdown3 being the dropdown box for Sub Cat.

    I have messed with the Result/Value parts of the function in the Update fields as well, switching them around...even leaving them out. Main Cat doesn't give an error for having Result there, but Sub Cat gives an error for having Value or Result there, no error if I leave it out entirely though. The error there is the "Name Isn't valid. The identifier isn't recognized." 


  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Dll10685 .Selected.Value should work fine in both cases or you can try .SelectedText.Value which would also return a text. Updating these values to the SP list also shouldn't be an issue as they are only text and it does not matter where they come from. What issues are you having with submitting to the SP list?

  • Dll10685 Profile Picture
    28 on at

    I also tried SelectedText, but had no success, before coming here.

    The issue I'm having is all but the Category fields update in my main SP List 1 site once I submit the form. They just appear as blank, no value/text will populate in those columns only. The rest will populate just fine, but these two Category fields are the only cascading fields on the form, so I'm assuming it has something to do with that? 

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Since you are saving the data to a text field in SharePoint you need to change the Update formula so it isn't saving it as a record.

    Example of Update property:

    Main Category is Update = Dropdown1.Selected.Result

    Sub Category is Update = Dropdown3.Selected.Value

  • Dll10685 Profile Picture
    28 on at

    I currently had it set as that but with the {Value: portion added to it. I just removed it though to see if it would work, and it did not. With that setup, I do get an error for Main Category now, saying "Expected record value. The Property on this control expects Record values. The rule produces Text values which are incompatible." Sub Category spits out the same "Name isn't valid. This identifier isn't recognized" error. 

  • Dll10685 Profile Picture
    28 on at

    So, I managed to get those two fields to show now! However, they show as an individual item. Is there any way I can have it show as one list when submitting a form? The Other >> should be on the item below it, but submitting the form creates two line items now. I managed to figure out part of the Patch method when submitting a form, which is how I was able to get those two fields to show now. 

    Dll10685_0-1621889643534.png

     

  • Dll10685 Profile Picture
    28 on at

    Alright, so now I have it so it posts one line item, but now it wont post the Main Category item. Attached screenshot, red box portion should say "Other." The formula for when I click the Save button is:

    OnSelect = Patch('SP List 1',Defaults('SP List 1'),{Main_x0020_Category:ddMC.SelectedText.Result, Sub_x0020_Category:ddSC.SelectedText.Value}, SharePointForm1.Updates)


    I ended up changing my dropdown names to ddMC and ddSC. Am I on the right path? This method also seems to submit a new form even when I just want to edit the form, but figured that could be looked at once I tackle this issue.

     

    Dll10685_0-1621894882564.png

     

  • Verified answer
    Dll10685 Profile Picture
    28 on at

    So, turns out I was misunderstanding the Patch function. I was able to fix it by patching ALL of the fields, and not just the cascaded dropdowns (just in case anyone else finds this). So my formula looks like this now, 

     

    Patch('Main SP List', Defaults('Main SP List'),
    {
    'Column 1 Name': DataCardValue1.Text,
    'Column 2 Name': DataCardValue2.Selected,
    'Column 3 Name': DataCardValue3.Text,
    'Column 4 Name': DataCardValue13.Text,
    'Column 5 Name': DataCardValue4.Text,
    'Column 6 Name': DataCardValue7.Selected,
    'Column 7 Name': DataCardValue16.Text,
    'Column 8 Name': DataCardValue5.Text,
    'Column 9 Name': DataCardValue6.Text,
    'Column 10 Name': ddMC.SelectedText.Result, <<These being the cascaded dropdown options that started this 
    'Column 11 Name': ddSC.SelectedText.Value,   <<
    'Column 12 Name': DataCardValue15.Text,
    'Column 13 Name': DataCardValue8.Selected,
    'Column 14 Name': DataCardValue9.Selected,
    'Column 15 Name': DataCardValue10.SelectedDate
    }
    )

     

    This is working for me. So hopefully it helps whoever finds this and has similar issues! Depending on the type of field your adding to the Submit Patch will change the end of the string. .Text being a field where I type text into, .Selected being a box where I make choices already in place in SharePoint, .SelectedDate being for the Date input (and I think it had to go last? Kept giving me an error until I made it last), and the SelectedText.Result/Value being the two cascaded dropwdown menus. 

    Thanks for the help @Jeff_Thorpe and @CNT !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard