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 Number to Sharep...
Power Apps
Suggested Answer

Patch Number to Sharepoint List then Display Success Notification if value = x

(2) ShareShare
ReportReport
Posted on by 118
Hi,
 
I am using a canvas app and wanting to patch a number value to a Sharepoint List Column (number) "numCheckListObjectValue", (but there may already be a value) in the existing Sharepoint List Column (number) "numCheckListObjectValue"
 
So when i patch the value i do NOT want to overwrite the value in the Sharepoint List Column (number) "numCheckListObjectValue" - I just want to add the patched value to the existing value. The value i want to patch is 4.
 
Then when patched i want to check if the updated Sharepoint List Column (number) "numCheckListObjectValue" = 16.
If the value "numCheckListObjectValue" = 16 then display a screen notification to say "Maximum Value has been reached!!", if the value <> 16 then do nothing.
 
Any assistance appreciated.
  • Suggested answer
    Haque Profile Picture
    4,189 Super User 2026 Season 2 on at
    Hi @CU10041356-0,
     
     
    First, oyou need to retrieve the current value of numCheckListObjectValue. Add 4 to it, then Patch  the updated value back to SharePoint. Finally, after pathcing, let's check if the new value is equal to 16 - show notification accordingly.
     
    I assume you have the current record in a variable or context e.g varCurRecrod.
     
     
    //-- We Calculate new value by adding 4 to existing value
    Set(
        varNewValue,
        Coalesce(varCurRecord.numCheckListObjectValue, 0) + 4
    );
    
    // Patch the new value to SharePoint
    Patch(
        SPList,
        varCurRecord,
        {
            numCheckListObjectValue: varNewValue
        }
    );
    
    // Let's check if new value equals 16 and notify
    If(
        varNewValue = 16,
        Notify("Maximum Value has been reached!!", NotificationType.Warning)
    )
    
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    Valantis Profile Picture
    7,371 Super User 2026 Season 2 on at
     
    Patch updates a record in place when you give it an existing record, and it returns the updated record back, so you can check the new value straight off the Patch call itself instead of looking it up again.
     
    Notify syntax is Notify(Message, NotificationType, Timeout), NotificationType.Error works for this kind of warning.
     
    Putting those together, this reads the current value, adds 4, patches it, then checks the result of that same patch:
    With(
        { _current: LookUp(YourSharePointList, ID = ThisItem.ID) },
        With(
            {
                _updated: Patch(
                    YourSharePointList,
                    _current,
                    { numCheckListObjectValue: _current.numCheckListObjectValue + 4 }
                )
            },
            If(
                _updated.numCheckListObjectValue = 16,
                Notify("Maximum Value has been reached!!", NotificationType.Error)
            )
        )
    )
     
    Using With twice avoids hitting the list a second time just to check the value, the outer With grabs the current record once, the inner With captures Patch's own return value and checks that directly.
     
     
      Best regards,

    Valantis   ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/ 💼 LinkedIn   ▶️ YouTube
  • Suggested answer
    BilalDev_01 Profile Picture
    86 on at
    Hi @CU10041356-0
     

    You can add the existing SharePoint value to your new value instead of overwriting it.

    For example, if the value you want to add is 4:

    With(
        {
            NewValue: Coalesce(
                LookUp(
                    'Your SharePoint List',
                    ID = ThisItem.ID,
                    numCheckListObjectValue
                ),
                0
            ) + 4
        },
        Patch(
            'Your SharePoint List',
            LookUp('Your SharePoint List', ID = ThisItem.ID),
            {
                numCheckListObjectValue: NewValue
            }
        );
    
        If(
            NewValue = 16,
            Notify(
                "Maximum Value has been reached!!",
                NotificationType.Success
            )
        )
    )
    

    Coalesce() handles cases where the SharePoint value is blank, treating it as 0.

    If you want to prevent the value from going above 16, you can also add a condition before the Patch.

    This is concise enough for a Community answer while still giving them a directly usable formula.
    
  • Suggested answer
    11manish Profile Picture
    4,609 Super User 2026 Season 2 on at
    use the With() + Coalesce() pattern above. It keeps the calculation readable and, importantly, lets you check the new calculated value rather than having to make another SharePoint lookup after Patch().
    example:
    With(
        {
            NewValue: Min(
                Coalesce(ThisItem.numCheckListObjectValue, 0) + 4,
                16
            )
        },
        Patch(
            'My SharePoint List',
            ThisItem,
            {
                numCheckListObjectValue: NewValue
            }
        );
        If(
            NewValue = 16,
            Notify(
                "Maximum Value has been reached!!",
                NotificationType.Success
            )
        )
    )
     
  • Suggested answer
    WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at
    ​​​​​I am assuming here that you are patching in increments of 4, so you may have reached 16 already or will do so this patch. I am also assuming you have selected the record from a Gallery (otherwise the record LookUp below will be different).
    With(
       {
          _Record:
          LookUp(
             SPListName,
             ID = GalleryName.Selected.ID
          )
       },
       If(
          _Record.numCheckListObjectValue < 16,
          Patch(
             SPListName,
             _Record,
             {numCheckListObjectValue: Record.numCheckListObjectValue + 4}
          )
       )
    );
    If(
       Record.numCheckListObjectValue >= 12,
       Notify(
          "Maximum Value has been reached!!",
          NotificationType.Information,
          5000
       )
    )
    So what you are doing here
    • Finding the relevant record
    • If it is already 16, then do not patch
    • If under 16, add 4 to it.
    • If it was 12 more more at the start, then it has to be 16 now, so display the message
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    Henil Profile Picture
    12 on at

    Hi @CU10041356-0,

    You can do this by adding 4 to the existing SharePoint value inside your Patch(), then checking the updated value.

    If your button is inside a Gallery, ThisItem will give you the current record directly:

    With(
        {_newValue: Coalesce(ThisItem.numCheckListObjectValue, 0) + 4},
        Patch(
            YourSharePointList,
            ThisItem,
            {numCheckListObjectValue: _newValue}
        );
        If(
            _newValue >= 16,
            Notify("Maximum value reached!", NotificationType.Success)
        )
    )

    This keeps the existing value and adds 4 to it rather than overwriting it. So if the current value is 8, it becomes 12. If it's 12, it becomes 16 and the notification pops up. If it is blank, Coalesce() treats it as 0, so it just becomes 4.

    If your button is not inside a Gallery, ThisItem won't be work, so you'll need to look up the record first using its ID:

    With(
        {_record: LookUp(YourSharePointList, ID = YourRecordID)},
        With(
            {_newValue: Coalesce(_record.numCheckListObjectValue, 0) + 4},
            Patch(
                YourSharePointList,
                _record,
                {numCheckListObjectValue: _newValue}
            );
            If(
                _newValue >= 16,
                Notify("Maximum value reached!", NotificationType.Success)
            )
        )
    )

    Just replace YourRecordID with however you're identifying the SharePoint item in your app.

    A couple of small tweaks I made compared to what's usually posted:

    • I check the value before patching, not after. This is a bit safer since it doesn't rely on reading the value back from SharePoint after the update.
    • I used >=16 instead of = 16. If 16 is your max, this makes sure the notification still shows even if the value ever skips past 16 for some reason (like a different increment being used somewhere else in the app).

    Could you confirm where this formula is running - inside a Gallery, from a Form, or from a standalone button? That'll help pin down the best way to reference the record.

    Hope this helps!

    Best regards,
    Henil Patel

    ✅ If this solved your issue, please Accept as Solution so others with the same question can find it easily.
    👍 If you found the reply helpful, feel free to give it a Like.
    💼 Happy to connect on LinkedIn: https://www.linkedin.com/in/henil-patel25/

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard