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 / SharePointIntegration ...
Power Apps
Answered

SharePointIntegration Onsave not working

(0) ShareShare
ReportReport
Posted on by 26

Hi Team,

May I ask what is the problem on my below onsave formula in SharePointIntegration

UpdateContext({
HistoryLogs: BusinessJustificationLogs.Text & Char(10) & " " & Text(
Now(),
DateTimeFormat.ShortDateTime
) & " " & Left(
User().Email,
Find("@", User().Email) - 1
) & ": " & BusinessJustification.Text
})
SubmitForm(SharePointForm1)

It shows error under SubmitForm showing "Expected operator. We expect an operator such as +,*,or & at this point in the formula.
So what I have here, 2 text box and I want all input text from textbox1 will be logged as history in textbox2 when I hit save on the form. TIA

Categories:
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Well, the problem with your code is that it's missing a semi-colon to separate the logic actions:

    UpdateContext(
     {
     HistoryLogs: BusinessJustificationLogs.Text & Char(10) & " " 
     & Text(Now(),DateTimeFormat.ShortDateTime) & " " 
     & Left(User().Email,Find("@", User().Email) - 1) & ": " 
     & BusinessJustification.Text
     }
    );
    SubmitForm(SharePointForm1)

     

    But I think the question is whether that context variable is somewhere on your SharePointForm1 form - as you're updating it but unless you're using it in the form it won't be used?

  • JohnRick_07 Profile Picture
    26 on at

    Adding semicolon did not work. 

    When I use the formula on a button it is working fine. 

    However when I use it on SharePointIntegration onsave it is not working. 

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Ok, have you tried making your OnSave select the button that works?

    like:

    Select(ButtonName)

  • JohnRick_07 Profile Picture
    26 on at

    I don't want to use the button that is why I transferred the formula to SharePointIntegration onsave which is not working. 

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    if it works on a button, use a button, hide the button, then have your OnSave select the button

  • JohnRick_07 Profile Picture
    26 on at

    How I will be able to select the button on the OnSave?

  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Yes, that's aright - I just tested - you can't use Select and you can't use UpdateContext on an App property function - this is why you r code doesnt work on the OnSave

     

    You can, however, use the Set() function as this is not screen-dependent,

     

    Set(
     HistoryLogs, BusinessJustificationLogs.Text & Char(10) & " " 
     & Text(Now(),DateTimeFormat.ShortDateTime) & " " 
     & Left(User().Email,Find("@", User().Email) - 1) & ": " 
     & BusinessJustification.Text
    );
    SubmitForm(SharePointForm1)

     

    So you just need to make sure that everywhere else that you've used UpdateContext for that variable you change it to Set to make it a global variable

  • JohnRick_07 Profile Picture
    26 on at

    Thanks a lot! 🙂 It is resolved by using Set()

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

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard