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 / Change the name column...
Power Apps
Answered

Change the name column with a condition

(0) ShareShare
ReportReport
Posted on by 29

Hello everyone!

 

I have the SP List for my products where one of the columns is for the responsible seller and the other is for the status of the merchandise (Sold, in stock, free ...).
I have a galley with all the products and after selecting which one you want to know more you navigate to a second screen to detail that specific product.
On this second screen I created a Combobox with the Patch function that allows changing the status of the product and updating the SP List.
However, I wanted to implement two improvements:


1. When the user of the App changes the product status to "Free" I want the field with the name of the seller to be deleted, leaving the product available without any name of the seller.

 

2. It is for when the product is available with "Free" and the user of the App (the seller) wanted to put his name as a responsible seller in the list column. Example: The seller sold the product that was in "Free" status, so he changed the status to sold (as I have already implemented) but the seller field is now named.

Can someone help me?

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @santpaiva 

    Can you please share your code, this will help us help you.

     

    For 1,

    Pseudo -code could look like:

    If( Status = "Free",
        Patch(yourSource, 'Item to update', {Status: "Free", Seller: Blank()}),

        // else

        ... your current Patch() statement here ...

    )

     

    I don't understand what's being asked in Part 2, sorry.

  • santpaiva Profile Picture
    29 on at

    Thanks for responding but it didn't work.

    1. I made the code with your idea, there was no error but there is also no change in the Seller field.
    If (Gallery_products.Selected.Status.Value = "Free",
    Patch (Base, Gallery_products.Selected.Status.Value, {Seller: Blank ()}),
    )
    In this EditForm, I only wanted to delete the Seller's name when the Product Status becomes "Free", that's all.

    2. This second question is for after the first is resolved. The product with status = "Free" and with the empty seller field will be an available product. Now, a seller has sold this product, so in EditFilm he will manually change the status to "Sold" (this is already possible to do and is correct), but I want the Seller field to automatically receive the user's name.

    I tried something like:
    If (Gallery_products.Selected.Status.Value = "Sold",
    Patch (Base, Gallery_products.Selected.Status.Value, {Seller: User (). FullName}),
    )
    but it doesn't work.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @santpaiva 

    1. Turns out you cannot Patch() a Blank() to a Choice field, I tried and failed. The best option, after some Googling, is to add a Choice to your list that meets your needs, eg

     

    -- Choose a Seller --

     

    Then, when you patch, update the Seller field to this option, like this

    If( Gallery_products.Selected.Status.Value = "Free",
     Patch(Base, Gallery_products.Selected, 
     {Seller: {Value: "-- Choose a Seller --"}})
    )

     

    For 2, try this

    If( Gallery_products.Selected.Status.Value = "Sold",
     Patch(Base, Gallery_products.Selected, 
     {Seller: User().FullName})
    )

     

     

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard