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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to "Patch" data...
Power Apps
Unanswered

Trying to "Patch" data from two Sharepoint Lists to one

(0) ShareShare
ReportReport
Posted on by 105

Overview:

The user picks say "IT" from the "Departments" dropdown then the next dropbox only shows the relevant "Job Titles" (based on the previous selection).

Then the "submit" button patches the data to the "main" SPList.

 

What I've got so far:

I have a “Patch” function that updates a Sharepoint List, which works (firstname, lastname etc up until "Department and Job Title)

AccountMaintenance-01-StaffOnboarding-Main_v2

f2_0-1684418732785.png

Departments and Job Titles are taken for this 2nd SPList:

 

AccountMaintenance-01-StaffOnboarding-JobTitleSupport

f2_1-1684418865382.png

 

So here is my "Patch" funtion currently, its on the OnSelect property of a button  (I commented out Department as throws up an error but thats what I'm working with)

 

 

Patch(
 'AccountMaintenance-01-StaffOnboarding-Main_v2',
 Defaults('AccountMaintenance-01-StaffOnboarding-Main_v2'),
 {
 RequestID: txtRequestID.Value,
 'First Name': txtFirstName.Value,
 'Last Name': txtLastName.Value,
 'Personal email address': txtPersonalEmail.Value,
 'User Role':dropUserRole.Selected
 //Department: Text(dropDepartment.Selected.Value)
 }
)

 

 

 

Department does appear in the powerapp dropdown by using the following in the "Item" property but "JobTitles" isnt smart/dynamic

 

 

'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.Departments

 

 

f2_0-1684429009986.png

 

Any ideas?

  • I was also hoping that if the user picks say IT from the "Departments" dropdown then it then only shows the "Job Titles" relevant to that previous selection.
  • Then the "submit" button patches the data from the 2nd list to the "main" SPList.

I'm pretty new to powerapps, when googling this problem I can only see writing data to two or more SPLists not take data from two and write to one.

 

Thanks for any advice or suggestions.
(I'm using the modern controls, not sure if that makes a difference or not)

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @f2,

    Do you want to make the JobTitle dropdown display items based on the department selected?

    Could you please tell me that if both of the Department and JobTitle are Single-line-of-text column in AccountMaintenance-01-StaffOnboarding-Main_v2?

     

    If both of them are Text column, please try the following steps:

    1). "Items" property of the Department dropdown:

    'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.Departments

    2). "Items" property of the JobTitle dropdown:

    If(dropDepartment.Selected.Value="IT",'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.IT
     dropDepartment.Selected.Value="Finance",'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.Finance
    )

    3). Modify your Patch() as below:

    Patch(
     'AccountMaintenance-01-StaffOnboarding-Main_v2',
     Defaults('AccountMaintenance-01-StaffOnboarding-Main_v2'),
     {
     RequestID: txtRequestID.Value,
     'First Name': txtFirstName.Value,
     'Last Name': txtLastName.Value,
     'Personal email address': txtPersonalEmail.Value,
     'User Role':dropUserRole.Selected
     Department: dropDepartment.Selected.Department
     JobTitle:If(dropDepartment.Selected.Department="IT",dropJobTitle.Selected.IT,dropJobTitle.Selected.Finance)
     }
    )

     

    Note that I assume that you want to populate the JobTitle with different columns based on the department selected, if you select IT from dropDepartment, the dropJobTitle will display job titles from IT column from your second list.

  • f2 Profile Picture
    105 on at

    Hi @v-qiaqi-msft 

    Thanks for replying!

    Yeah, thats right I was hoping to get the Job Title dropdown based on the Department dropdown and they are both single lines of text in the Sharepoint list.

     

    When putting in the code for the "Item" property for "Job Title" I get this error:

    f2_0-1684493356344.png

    Error message:

    f2_3-1684493663096.png

     

    I've tried various things to try resolve it, closest I can get is putting a "," comma at the end of the first line but it still doesnt seem to like ".Value=":

    f2_1-1684493428727.png

    Error message:

    f2_4-1684493694078.png

     

    f2_2-1684493549924.png

     

    I've tried deleting the control, trying both old style and modern controls and nothing seems to be working for me...however the Departments drop down is working perfectly. I've also been asking ChatGPT and it suggested double "==" but the error mentioned was talking about a boolean so I think it got mixed up.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @f2,

    Okay, I get it.

    You are right, the Value parameter is not matched here. Rerfer to dropDepartment.Selected.Department

     

    Modify your formula as below, here you need to refer to the Department column name directly:

    If(dropDepartment.Selected.Department="IT",'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.IT
     dropDepartment.Selected.Department="Finance",'AccountMaintenance-01-StaffOnboarding-JobTitleSupport'.Finance
    )

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 840 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 332 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 275

Last 30 days Overall leaderboard