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 / Patch Collection with ...
Power Apps
Answered

Patch Collection with Complex Columns to existing SP List

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I am trying to create a repeating row for capturing actions associated with a change management. The issue i'm having is with the complex columns. I get the following error:

This type of argument "action_x0020_owner" does not match the expected type 'record'. Found type 'text'.  The formula i have is:

 

ForAll(ActionCollection, If(!IsBlank(Action),Patch('Change Management Actions List', Defaults('Change Management Actions List'), {Action:ActionC,'Action Owner':ActionOwner,'Due Date':DueDateC, Status:StatusC, Comments:CommentsC, CMMasterIDA: Var3, 'Change Title': Var4})));

 

Cym_0-1597018813932.png

 

See following screenshots for associated formulas

Cym_1-1597018853723.png

 

Cym_3-1597018922341.png

Cym_4-1597018946752.png

 

 

 

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    Complex columns contain tables and not a single value, hence your error. This applies to all Complex column types.

     

    Try this slight adjustment to you formula:

     

    ForAll( ... { ... Action Owner':{ Value: ActionOwner}, ...} ... )

  • Community Power Platform Member Profile Picture
    on at

    thanks, i tried that but it still gives an error :

     

    ForAll(ActionCollection, If(!IsBlank(Action),Patch('Change Management Actions List', Defaults('Change Management Actions List'), {Action:ActionC,'Action Owner':{value:ActionOwner},'Due Date':DueDateC, Status:StatusC, Comments:CommentsC, CMMasterIDA: Var3, 'Change Title': Var4})));

     

    error message:

    Invalid argument type. Expecting a record type but of a different schema

    missing column, your formula is missing a column 'Claims' with a type of 'Text'

    the function 'patch' has some invalid arguments

  • Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    My apologies, I thought PowerApps had made this easier to do - obviously not for People fields. The structure you need is something like this:

    { 
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
    DisplayName:User().FullName, 
    Claims:"i:0#.f|membership|" & Lower(User().Email), 
    Department:"", 
    Email:User().Email, 
    JobTitle:"", 
    Picture:"" 
    }

    link: https://www.c-sharpcorner.com/article/set-default-value-to-person-or-group-field-in-powerapps/

     

    Using your example, this should work though you may need to tinker with it (replace everything inside the the {}'s from my first post with this code):

    { 
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
    DisplayName: ActionOwner.FullName, 
    Claims:"i:0#.f|membership|" & Lower(ActionOwner.Email), 
    Department:"", 
    Email:ActionOwner.Email, 
    JobTitle:"", 
    Picture:"" 
    }

    This assumes that 'ActionOwner' contains Person type data and isn't a simple text field in your app. If it is a simple text type data then you will need to use a LookUp() to find the above data.

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks for that!  Can you show me how to  structure it with the lookup? The field is simple text in the app....

    Also, I probably only need the display name - do i need to have all of the other fields?

  • Community Power Platform Member Profile Picture
    on at

    ...Also, tried that, but same error.....

     

    Thanks so much for your help

  • Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    Not sure re 'Display Name only ...' but yeah you may be able to get away with it?

     

    The LookUp would be something like this:

     

    LookUp( Choices('Change Management Actions List'.'Action Owner'), FullName = ActionOwner.Text)

     

    To use it in your Patch, try replacing the between {..}'s with this

    {...
    DisplayName: 
     LookUp( Choices('Change Management Actions List'.'Action Owner'), 
     FullName = ActionOwner.Text, FullName)
    ...
    }

    The original error did mention that you needed Claims so you may need to added that or even everything, not sure.

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks so much for trying. Still can't seem to get it to work though....

  • Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    Can you share the last code you tried?

     

    Also, that last post of mine may have been a little confusing. Just using 'DisplayName' you entire Patch should be

    ForAll(
     ActionCollection, If(!IsBlank(Action),
     Patch('Change Management Actions List', Defaults('Change Management Actions List'), 
     {Action:ActionC,
     'Action Owner': {
     DisplayName: LookUp( Choices('Change Management Actions List'.'Action Owner'),
     FullName = ActionOwner.Text, FullName)},
     'Due Date':DueDateC, Status:StatusC, Comments:CommentsC, 
     CMMasterIDA: Var3, 'Change Title': Var4}
     )
    );

     

     

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you tell me the data type of 'Action Owner'  field?

    If it is person type, whether it allows multiple value?

    Could you tell me what kind of data you fill in the textinput for 'Action Owner'  field? How do you set this variable ActionOwner?

    As you known, you should update person field with data like this:

     { Claims:"i:0#.f|membership|"&emailaddress,
     Department:"",
     DisplayName:username,
     Email:emailaddress,
     JobTitle:"",
     Picture:""}

    You need to update with email address and user name.

    So could you tell me what data you use to represent email address and user name?

    Please update with formula like this:

    ForAll(
     ActionCollection, If(!IsBlank(Action),
     Patch('Change Management Actions List', Defaults('Change Management Actions List'), 
     {Action:ActionC,
     'Action Owner': 
    { Claims:"i:0#.f|membership|"&emailaddress,
     Department:"",
     DisplayName:username,
     Email:emailaddress,
     JobTitle:"",
     Picture:""}
     )
    );

    //please fill in email address and user name. For example: Textinputname.Text

     

     

    Best regards,

  • MonicaJ Profile Picture
    20 on at

    Do you have another column in your list named "Action Owner"? 

    I had same issue with "Department" property, reason for error was I had column named "Department in my list. So PowerApps patch function got confused between column and Person/Group property.

    I renamed by column - Department to something else and issue got resolved.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard