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 Apps
Answered

GUID - patching

(0) ShareShare
ReportReport
Posted on by 297

hi All,

in my Idea App when a user submits an idea he gets a GUID number , which is generate by pressing the "Submit" button. I just have no idea how to patch this GUID to Sharepoint to the appropriate column. Could you please help me? 

martatracik_0-1677255321298.png

martatracik_1-1677255351205.png

 

 

Categories:
I have the same question (0)
  • martatracik Profile Picture
    297 on at

    i modified a little bit GUID variable for:

     

    Set(varGUID, Text(GUID())); 

     

    my patching formula looks like that (GUID is a name of column on SharePoint list 'Suggestion Box')

     

    Patch(
     'Suggestion Box',
     Defaults('Suggestion Box'),
     {
     'GUID': varGUID
     }
     );

     

     

  • mmollet Profile Picture
    3,187 on at

    Here is the syntax for the patch function:

    Patch(SP_List_Name, {column1: number, column2: "string", column3: true, etc...});

    What this does is it will create a new entry in your SP list and will pass the values inside the { } into the columns you defined in the { } as well. 

    Things to keep in mind:

    1) required columns must be present in the Patch statement or they will throw an error. (also remember that the title column on a new SP list is by default required so either change that or make sure you patch title)

    2) if you want to edit an entry that already exists, patch can be used to do that as well but requires a slightly different syntax

    3) Patching complex columns is a complete pain and I avoid using them in SP at all costs. I use text and number types only when possible.

     

    If you want to give the user a unique number for their submission, you could always use the ID column that SP auto-generates. This is a unique int value that can be returned to Power Apps after the item is created in SP using the following syntax:

     

    Set(newItem, Patch(SP_List_Name, Defaults(SP_List_Name), {column1: number, column2: "string", column3: true, etc...}));

     

    The only difference is the set and defaults functions. Set is creating a global variable called newItem and will store the item returned from SP using the Defaults function. Once you add this, the user will click the button, the patch statement will execute and create a new item in the SP list and then will return that item to PA and store it in newItem. You can then show "newItem.ID" and it will be the unique ID number for their line item they just submitted. You can use this to fetch that item later like this: Lookup(SP_List_Name, ID = newItem.ID) and it will return the entire item from SP including the data they entered into the app as well as auto-generated columns from SP. 

     

    If this solves your problem please mark as the solution! If not help me understand what you need better and I will take another crack at it! =^D

  • martatracik Profile Picture
    297 on at

    thank you 🙂 i dont really want to give an ID from SP, as i want to give EndUsers  possibility to check their submission entering GUID. (somebody might enter random ID and check somebody's else idea).  can i add someway GUID to sharepoint form maybe?

  • Verified answer
    mmollet Profile Picture
    3,187 on at

    You can do the same thing as I mentioned but with your GUID column. The issue is that 2 users could create the same GUID so make sure you are looking in that list to check for duplicates before they get to choose a GUID number. 

     

    Something on that textbox where they enter the desired GUID such as:

    Fill Property: If(IsBlank(Lookup(SP_List_Name, GUID = usersDesiredGUID), White, Red)

     

    This will make the box red if they enter a  GUID that is already in the list. You could do this same idea with the visibility of the submit button etc. Just want to make sure duplicates dont happen as that can be a pain in the PowerApp 😉

  • martatracik Profile Picture
    297 on at

    thanks, finally i made something like that:

    Set(
     varGUID, 
     Text(GUID())
     );
    
    Patch(
     'Suggestion Box',
     Defaults('Suggestion Box'),
     {
     Title:TxtInp_Title.Text,
     Description: TxtInp_Desc.Text, 
     AnonymousRequest:Toggle1.Value,
     GUID: varGUID
     },
     Form1_1.Updates
     );

     unfortunately one person already submitted one idea without GUID, do you know if i can filter gallery under two conditions that are in the same Text Input field?

    Filter('Suggestion Box',GUID=GUID_Input.Text, ID=Value(GUID_Input.Text))

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard