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 / Patch a GUID from a co...
Power Apps
Answered

Patch a GUID from a collection to a SharePoint List

(0) ShareShare
ReportReport
Posted on by 603

Hi All,

 

I'm trying to work with a GUID that I've saved in a collection.

I do that with the follow code:

Collect(COLRefID,{RefID:Text(GUID())})

When I want to patch a couple of input field from my App to the SharePoint list, I want to use the generated GUID from my collection (And use the same GUID in a later process in my app).

 

I've created the follow patch code to achieve my goal, but something is not right:

Patch('Item Request',Defaults('Item Request'),{'Item number':TXT_NewItemNumber_1.Text,'Item name':TXT_NewItemname_1.Text,Division:DR_DivisionSelect_1.SelectedText.Value,Category:DR_ProductSelect_1.SelectedText.Value,RefID:COLRefID.RefID})

 

I've got the following issue:

The type of this argument 'RefID' does not match the expected type 'Text'. Found type 'table'.

 

What I'm doing wrong?

When I use the follow command (without the collection option) it's working fine, but I need the same GUID (RefID) in the next step of my app.

Patch('Item Request', Defaults('Item Request'),{'Item number':TXT_NewItemNumber_1.Text,'Item name':TXT_NewItemname_1.Text,Division:DR_DivisionSelect_1.SelectedText.Value,Category:DR_ProductSelect_1.SelectedText.Value,RefID:Text(GUID())})

 

Is there someone who know what I'm doing wrong/ how to fix this?

 

Thanks in advance.

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @dennisb88 

    A collection is a table.  If you are only storing one value in your collection, then consider using a variable instead of a collection as you don't need a table for it.

     

    To correct the problem you have now, you can change your formula to the following:

    Patch('Item Request',
     Defaults('Item Request'),
     {'Item number':TXT_NewItemNumber_1.Text,
     'Item name':TXT_NewItemname_1.Text,
     Division:DR_DivisionSelect_1.Selected.Value,
     Category:DR_ProductSelect_1.Selected.Value,
     RefID:First(COLRefID).RefID
     }
    )

     

    To move away from the collection for this, simply change your collection to a variable:

    Set(varRefID: Text(GUID()))

    Then your Patch formula would be the following:

    Patch('Item Request',
     Defaults('Item Request'),
     {'Item number': TXT_NewItemNumber_1.Text,
     'Item name': TXT_NewItemname_1.Text,
     Division: DR_DivisionSelect_1.Selected.Value,
     Category: DR_ProductSelect_1.Selected.Value,
     RefID: varRefID
     }
    )

     

    Also notice in the above formulas that I replaced the SelectedText with Selected.  SelectedText is a deprecated property and should not be used.

     

    I hope this is helpful for you.

  • dennisb88 Profile Picture
    603 on at

    Thanks @RandyHayes ,

     

    That's helping! I've changed it to a variable and it's working like a charm now!

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 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard