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 / Managing a variable va...
Power Apps
Answered

Managing a variable value with OnEdit and OnView SharePoint integration functions

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all, 

 

I am struggling to figure out to set a variable's value with OnEdit and OnNew SharePoint integration functions if that is all possible.

 

I am creating a SharePoint list with a status column which has quite a few statuses. In the canvas app, I have created a variable varStatus to set and control various status using the Switch function. 

 

 

Switch(
 varStatus,
 "Draft",
 {Value: "Draft"},
 "Created",
 {Value: "Awaiting docs"},
 "Technologists",
 {Value: "Selecting technologists"},
//and so on

 

 

 

 

Then I am using several buttons which set varStatus value like this:

 

 

/*set status var*/
Set(
 varStatus,
 "Draft"
)

 

 

 

 

I am also saving the text value of the varStatus to a text column varStatus_Textvalue, which has its Default = 

 

If(
!IsBlank(varStatus),
varStatus,
Parent.Default
)

 

 

Finally, I am trying to control varStatus value with the OnEdit and OnNew SharePoint integration functions. When the user tries to create a new item in the SharePoint list, I use <em>Set(varStatus, blank()) to reset the variable, but the user wants to edit an existing item, and I am trying to use the following function in the OnEdit SharePoint integration:

If(
!IsBlank(txt_varStatus.Text),
Set(
varStatus,
txt_varStatus.Text
)
)

However, the function above does not work for some reason.. Could someone please advice, if there is anything wrong with it?

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,928 Most Valuable Professional on at

    @Anonymous ,

    I am not sure this is the answer you want, but altering those built-in controls produce unexpected results, not just in Variables. I suggest you set them with other triggers on forms - for instance test for the FormMode of the form and set accordingly.

     

    Please click Accept as solution 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 giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz , thank you. Noted.

     

    Just to clarify, do you mean, I should test OnEdit and OnNew controls with the FormMode ? 

  • Verified answer
    WarrenBelz Profile Picture
    154,928 Most Valuable Professional on at

    @Anonymous ,

    No, if they do not work, leave the built-in controls alone. You may have to do something at Screen OnVisible.

    To be honest, if you are going to need to to complex things, consider a Canvas App - the integrated forms, from what I see were primarily designed to simply edit, view and create records and I have seen too many posts on things not working as the user expects.

     

    Please click Accept as solution 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 giving it Thumbs Up.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard