web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Values from variables ...
Power Apps
Unanswered

Values from variables not being saved after submission of an item

(0) ShareShare
ReportReport
Posted on by 383

Hi, I have a SharePoint customized form I've built in Power Apps, and am working on creating an approval process for it. As part of that, within the form I'd like to record the name/date of each person that approves it. 

 

Here is a screenshot of the relevant section - 

TrayH_0-1692036210587.png

 

And here is the OnSelect property of the Approve button - 

TrayH_1-1692036893478.png

 

I have the default property of the datacard values for the Approved By and Approval Date fields set to those variables - 

TrayH_2-1692036992046.png

TrayH_3-1692037040262.png

 

This setup works initially, and will populate the Approver Name and date when I click on the Approve button. The problem is that after submitting the form, if I go back into that same item those fields are once again blank. I'm assuming I need to put something for the variables into the various OnSave, OnEdit etc properties of SharePoint Integration object, but would like some guidance on what and where that needs to be.

 

 

Categories:
I have the same question (0)
  • Verified answer
    Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @TrayH - variables behave differently with customised forms. The variables remain persistent, even if you close the Form.

     

    On the Default property of the Approval DataCard, use:

     

    If(
     IsBlank(varUnderwriterApprovedBy),
     ThisItem.'Your Approver Name Field',
     varUnderwriterApprovedBy
    )
    

     

    On the OnSelect property of your Approve button, use:

     

    Set(
     varUnderwriterApprovedBy,
     User().FullName
    )

     

    For the following properties of SharePointIntegration, use:

     

    OnNew:

     

    NewForm(SharePointForm1);
    Set(
     varUnderwriterApprovedBy,
     Blank()
    )

     

    OnSave:

     

    SubmitForm(SharePointForm1);
    Set(
     varUnderwriterApprovedBy,
     Blank()
    )

     

    OnCancel:

     

    ResetForm(SharePointForm1);
    Set(
     varUnderwriterApprovedBy,
     Blank()
    )
    

     

    Apply similar logic to your Approval Date Field.

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • TrayH Profile Picture
    383 on at

    I ran a few tests and I think that's working. Thank you!

     

    One question I have regarding the set variables in the SharePoint intergration object. Will I also need to add that to OnView of the SP Integration Object and OnSuccess of the SharePointForm1 object?

     

    The reason I ask is because in this same form, I followed a video from Reza where I used variables as part of setting up checkboxes in multiselect choice fields. In that he said for SP customized forms, to add the Set(varname,Blank()) to the following locations - 

     

    SharePoint Integration - 

    OnCancel

    OnEdit

    OnNew

    OnView

     

    And for the SharePointForm1 object:

    OnSuccess

     

    I just want to make sure I'm not missing anything. Thank you again!

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    Hi @TrayH ,

     

    I am not aware of Reza's video and I do not know in what context he is applying his advice to (although I am glad the advice I gave you is similar to his overall approach).

     

    In your context, I would only see a need to update the properties I outlined above (OnSave, OnNew, OnCancel).

     

    I do not see a need to update the OnSuccess property because this is already being handled by the OnSave property. I do not see any need to update the OnView property either because the example I gave should behave correctly without it.

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.


    Imran-Ami Khan

  • kmw1130 Profile Picture
    988 on at

    @Amik I have a similar question and wondering if I your solution would work.  I'm not using variables, but I am selecting a default value on the DataCardValue card using a lookup (this is to send approvals to), but I want to be able to update the DataCard (ThisItem.Field) to the approver that completed the approval process, because it could be different that my default in the DataCardValue.  But what is happening in my Update action in Flow, it is not updating the DataCard (ThisItem.Field), it keeps the default value of the DataCardValue with the Lookup.  I'm sure I am missing something, just not sure what.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard