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

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
Super User

@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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

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
Super User

@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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,205)