cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Coopedup
Resolver I
Resolver I

Recollect field value

Hey All,

 

Happy Friday!  (except for those reading on demand)

 

You select you record from a gallery and work on different screens. When a status is changed to Closed I wanted to add an automated message in our notes section.  I thought this was working but obviously testers knew better.

 

On the save button I had this simple check! if the selected value is different to the stored value and if the selected status is Closed then patch the note. After this patch the submitform happens and the record updated.  The problem discovered, is that if a user goes on to change another field without navigating away and reselecting the record the original value is referenced and keeps adding new notes. How can I refresh the stored value for RiskStatus.Value?

 

If(DataCardValue87.Selected.Value <> RiskStatus.Value && DataCardValue87.Selected.Value = "Closed", Patch('Register Notes', {Title: Title, NoteDetails: "This is an automated confirmation of risk closure at " & Text( Now(), "[$-en-GB]dd/mm/yyyy hh:mm:ss" ) }));

 

 

 

Cheers,

N

3 REPLIES 3
RandyHayes
Super User III
Super User III

@Coopedup 

From what I am hearing, you are updating the underlying record of the Form.

I would suggest having this occur during the submit form rather than before it.

 

If your NoteDetails is in your form (and it should be if not), then set the TextInput control Default property in that datacard to:

If(DataCardValue87.Selected.Value <> ThisItem.RiskStatus.Value && 
   DataCardValue87.Selected.Value = "Closed", 

   "This is an automated confirmation of risk closure at " & 
      Text( Now(), "[$-en-GB]dd/mm/yyyy hh:mm:ss"),

   Parent.Default
)

 

This will set the NotesDetail for you automatically during the SubmitForm and will avoid conflicting values and trying to patch before submit.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

The notes actually reside in a different SP List to the record that gets it status changed! On the save request I could change the order to patch the notes after the submission. but still need to refresh the value so I don't get further false notes being submitted.

RandyHayes
Super User III
Super User III

@Coopedup 

(it was worth the "assumption"!)

 

So, the way to accomplish this is was a snapshot variable.  However, before we can implement that, what is the Item property of your Form?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (21,723)