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 the record and s...
Power Apps
Unanswered

Patch the record and show and hide buttons

(0) ShareShare
ReportReport
Posted on by 237

 

Hello,

       I added blank gallery to the canvas screen.Each row contain draft and submit buttons.

When user select draft button ,data save in sharepoint list once record saved in sharepoint list with status= draft and draft button hide and same record user  onselect of submit button record saved in  sharepoint list with status=saved.

 I tried  while user select  submit  button getting below error,

 

Patch('Time sheet','Add Gallery_5'.Selected,
{Status:"Submitted"}),
Remove(Addweekdy,ThisItem)

 

Powerappsuser11_0-1691649376061.png

 

Thanks in advance for quick response....!!!

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Powerappsuser11 ,

     

    Could you please tell me:

    What is 'Add Gallery_5' 's items property?

    What is the error message?

     

    Maybe you could try:

    Patch('Time sheet',LookUp('Time sheet',ColumnName='Add Gallery_5'.Selected.ColumnName),
    {Status:"Submitted"});

     

    Best Regards,
    Bof

  • gcmfaizan Profile Picture
    1,022 on at

     

    Hi @Powerappsuser11 ,

    It seems like there's a syntax issue in 'Add Gallery_5'.Selected. You can't directly use the gallery like this. Instead, you should reference the Selected property of the gallery. Also, the Remove function should be placed inside the Patch function.

    Here's the corrected expression:

     

     

    Patch(
     'Time sheet',
     GalleryName.Selected, // Replace GalleryName with the actual name of your gallery
     {Status: "Submitted"}
    );
    Remove(GalleryName.AllItems, ThisItem) // Remove the item from the gallery

     

     

    Please accept it as solution. 

    Cheers!

     

  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @v-bofeng-msft 

     

    Gallery---Items=collection i.e Addweekdy

     

    I tried above code not getting any errors but the draft record not converted into submitted.

    Patch('Time sheet',
    LookUp('Time sheet',
    Description = 'Add Gallery_5'.Selected.Description),
    {status: {Value: "Submitted"}}
    );
    Remove(Addweekdy,ThisItem)

     

    Powerappsuser11_0-1691651027460.png

     

    On select of Draft my code is

     

    Patch('Time sheet',
              Defaults('Time sheet'),
    {
    Title:User().FullName,
    Email:User().Email,
    Description:'Add Gallery_5'.Selected.TextInput7_8.Text,
    Hour:Value('hour TextInput7_7'.Text),
    'Date and Time':'Add Gallery_5'.Selected.DatePicker6_5.SelectedDate,
    status:{Value:"Draft"},
    Project:
    {
    Id:Dropdown10_5.Selected.ID,
    Value:Dropdown10_5.Selected.'Project Name'
    },
    'Project Line':
    {
    Id:Dropdown11_5.Selected.ID,
    Value:Dropdown11_5.Selected.'Projectline Name'
    }
    });

     

    Kindly help to resolve the issue.

    Thanks...!!!
    Notify("Details are updated",NotificationType.Success);

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

    Hi @Powerappsuser11 ,

     

    Could you replace the Description with other fields with unique values, such as ID.

     

    Patch('Time sheet',
    LookUp('Time sheet',
    Description = 'Add Gallery_5'.Selected.Description),
    {status: {Value: "Submitted"}}
    );

     

    Best Regards,

    Bof

     

  • Powerappsuser11 Profile Picture
    237 on at

    Hi @v-bofeng-msft 

     

    I tried below conditions  No errors but not  draft record not updated into submitted.Not understanding what is the error in this,Please help.

     

    Patch('Time sheet',LookUp('Time sheet',Email=User().Email),
    { status:{Value:"Submitted"}});



    Patch('Time sheet',LookUp('Time sheet',ID='Add Gallery_5'.Selected.ID),
    { status:{Value:"Submitted"}});

  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @gcmfaizan 

     

    I Tried above getting like below

     

    Patch('Time sheet',
    'Add Gallery'.Selected,
    {
    status:"Submitted"
    });

     

    Powerappsuser11_0-1691654068805.png

     

  • gcmfaizan Profile Picture
    1,022 on at

    Hi @Powerappsuser11,

    Can you do one thing? Create a new Column name e.g. Custom Status column type is text and try to call this column in the Patch function and pass "Submitted" as value. because it looks like there is no column with the name that you use in the Patch function. 

  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @gcmfaizan 

     

     Yes,I tried But same result.  Draft Record not converted into submit.

    Is any other way to approach this one.

     

    Patch('Time sheet',LookUp('Time sheet',custom='Add Gallery'.Selected.Custom),
    { status:{Value:"Submitted"}});

  • gcmfaizan Profile Picture
    1,022 on at

    ok, one more thing, if yo still facing error even trying this: 

    Patch('Time sheet',LookUp('Time sheet',custom='Add Gallery'.Selected.Custom),
    { status:{Value:"Submitted"}});

     

    now create an auto-number column and in gallery add a button or icon, OnSelect property use

     

    UpdateContext({varUniqueId: Thisitem.YourAutoNumberColumn})

    Now in your Patch function:


    Patch('Time sheet',LookUp('Time sheet',YourAutoNumberColumn =varUniqueId),
    { CUstomStatus:{Value:"Submitted"}});

    And please try to change the Status column name with another name because the Status is a default column as well may be he confused with it. 

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
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard