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 / How to return value fr...
Power Apps
Answered

How to return value from a control to SharePoint list

(0) ShareShare
ReportReport
Posted on by 56

Hello,

 

I'm doing a canvas app for a flow based on Sharepoint list. In this list, there are 2 columns which defined parent and child menu.

- Column 'Parent_menu', Type 'Choice'. There are 10 choices defined for example;

- Column 'Child_menu', Type 'Single line of text'.

My idea is when user choose an item from 'Parent menu', it will nagavite to the another screen depends on the chosed item to ask the user to choose the value from a Drop-down control. On this Drop down Control, I defined ITEM = ["Case 1","Case 2","Case 3"]. How can I return this value that user chosed to Column 'Child menu' in Sharepoint list?

I tried set OnChange of the Drop-down control via Patch or Collect function. But it's not working.

 - Patch(data_source,{Child_menu:Child_menu.Selected.Value})

Anything wrong? Or you can give me any better solution?

 

Thanks a lot

CircleMi

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @CircleMi 
    I don't understand what you are trying to do here.  Please try to explain with a few pictures.  Show your app and indicate what needs to happen.  Then also show pictures of your SharePoint lists and the relevant columns.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @CircleMi ,

     

    Do you want to save the Child_menu value to a new record or a existing record?

    Form the below syntax, you can know that the Base Record part is missing in your formula. Reference from: Patch function 

    Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])

     

    If you want to save the Child menu value to a new record, please ensure some required columns are included in Patch formula.

     Patch(data_source, Defaults('data source'),{'Required Column': "Value", Child_menu:Child_menu.Selected.Value})

    Hope this helps.

    Sik 

  • CircleMi Profile Picture
    56 on at

    @mdevaney 

    Here is the detail.

    1. There is a SP list for IT request.

    A column 'T_1 Material Type' (Choice) is used for the parent menu, such as Computer, Software etc.

    A column 'T_2 Material Type' (single line of text) is used for child menu.

    SPL.jpg

    2. In the 1st screen of Canvas, I defined Navigation depends on the chosed value of 'T_1 Material Type' from the requester. For example, here the requester chosed 'Computer' then navigate to the 2nd screen.

    Screen 1.jpg

    3. In the 2nd screen, I created a Drop-down control named 'DD_T2menu'. I expected that the chosed value can be saved in the Column 'T_2 Material Type' when the request submitted.

    Drop_down_items.jpg

    I tried setting 'OnChange' of the Drop-down control, 

    Drop_down_onchange.jpg

     but after the request is submitted, you can see the result as the first snapshot that all information can be saved into Sharepoint list except for the column 'T_2 Material Type'.

    In addition, I got a system error when submitted the request 'Title is mandatory'. But 'Title' is not empty.

     

    Thank you in advance

    CircleMi

  • CircleMi Profile Picture
    56 on at

    @v-siky-msft 

    Hi,

    Thank you first of all. I just reply the detail of my idea and try then found your post.

    Yes, I used Patch function but it was failed.

     

    Best regards

    CircleMi

  • mdevaney Profile Picture
    29,993 Moderator on at

    @CircleMi 
    A PATCH function to create a new record could be structured like this.  You do need to specify the Title: it is required.  Your code does not insert it into the database like mine does so that's why you got an error.

     

    Patch(
     IT_Request,
     Defaults(IT_Request),
     {
     Title: TextInput_Title.Text,
     Comments: TextInput_Comments.Text,
     'T_1 Material Type' ComboBox_T1MaterialType.Selected,
     'T_2 Material Type': TextInput_T2MaterialType.Text
     }
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • CircleMi Profile Picture
    56 on at

    @mdevaney 

     

    Hello,

     

    You are right. It is working. But for the column(Choice) 'T_1 Material Type' is not working.

    'T_1 Material Type': ComboBox_T1MaterialType.Selected,

    System shows me the record type is wrong. If I changed it to a Column (Text), it's fine. How can I make it works on a Column(Choice)?

     

    In addition, I expected to use a SAVE icon or the default SAVE button in SharePoint webpage to submit the all data. If any possible to use submitFrom and Patch function together? Do you have any advice?

    Savedata.jpg

    Thanks

    CircleMi

  • CircleMi Profile Picture
    56 on at

    It's not a right decision to put Function Patch on the SAVE icon. Because when an user want to modify an existing item, the SAVE icon with Function Patch will create another item in the list.

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @CircleMi ,

     

    Do you mean you want to submit the form and save the 'T_2 Material Type' value to the same record, right?

    If so, please try this. Apply a If condition to adapt for both New Form and Edit Form.

    Patch(
     IT_Request,
     If(FormName.Mode= FormMode.New
     Defaults(IT_Request),
     FormName.Mode= FormMode.Edit
     LookUp(IT_Request,ID=SharePointIntegration.SelectedListItemID)),
     FormName.Updates,
     {
     'T_2 Material Type': DropdownName.Selected.Value
     }
    )

    Hope this helps.

    Sik

  • CircleMi Profile Picture
    56 on at

    @v-siky-msft 

     

    Yes,  I want to submit the form and get the value from a Drop-down to 'T_2 Material Type' to the same record. 

    I will try your solution. But user will not get any feedback after Function Patch finished. Is any possible give a feedback similar as SubmitForm()? 

     

    Thanks

    CircleMi

  • CircleMi Profile Picture
    56 on at

    @v-siky-msft 

     

    Yes, I add SubmitForm() in front of your statements, then it works. Thanks a lot.

     

    @mdevaney 

    Thanks a lot for your kind support.

     

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard