cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
User237
Helper III
Helper III

Update Button picking the wrong record.

Hi Experts,

I have used one button for update the record in edit form.

Formula used in the Onselect Property of the Update button is given below.

SubmitForm(EditForm1);UpdateIf('[MyTable]',Myfield1=BrowseGallery1.Selected.Myfield1,{Myfield2:2});Notify("Sales order rejected",NotificationType.Success).

For suppose, i have 10 records in mytable. when opened in editform it is picking the correct record. when clicking on the update button, it is working fine sometimes and not working sometimes. ie., sometimes it is picking the above record or below record and updating.

I have used the similar formula in another 2 edit forms there it is working fine.

Can anyone helpme to solve this?

Thanks in advance.

with regards,

user237.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @User237 ,

 

1. Yes, you can, but you have to modify the Items property of Form as follows to avoid the issue like UpdateIf() code.

 

LookUp('[MyTable]',Myfield1=varMyfield1)

 

2. Only change the required property of data card is not enough, please go to SharePoint list setting to see if the Field3 is required, if so, change that field to optional.

Hope this helps.

Sik

View solution in original post

5 REPLIES 5
User237
Helper III
Helper III

More details: - While editing the app it is working and after republishing the app, sometimes it is not updating the selected record in the same case it is updating the first record of the gallery. And sometimes it is updating random record.

 

Please help me to solve this (or) please tag to suitable one.

with regards,

user 237.

Hi all,

My requirement is,

I have added sql table as a connection to my form.

I need to update a value in the record in edit form by clicking the UpdateButton inside the form. 

After updating the record it need to show a message like success and come back to browseGallery.

 

Thanks,

with regards,

User237.

v-siky-msft
Community Support
Community Support

Hi @User237 ,

 

The cause of this issue is when a new record is submitted to the data source, the data source may be refreshed and the gallery selection may be reset to the first item or a random item. 

The solution is save the Gallery.Selected.Myfield1 to variable when selecting the gallery to keep the selection you want unchanged.

BrowseGallery1.OnSelect:

Set(varMyfield1, ThisItem.Selected.Myfield1)

 

Update button.OnSelect:

SubmitForm(EditForm1);
UpdateIf('[MyTable]',Myfield1=varMyfield1,{Myfield2:2});
Notify("Sales order rejected",NotificationType.Success)

 Hope this helps.

Sik

Hi @v-siky-msft ,

Thanks for your reply,

I will try this and let you know.

I have some queries i have mentioned below, can you please give clarity on those. 

1. In the updatebutton.onSelect formula which you have mention, can we change the Updateif to first place and submitForm() to second place?

2. In the edit form i need to update two values one is MyField2,second is MyField3. For that I used two buttons for Update. Button names are Approve and Reject.

My Requirement is, MyField3 may filled or may not filled. but when we are not filling the column and submitting the form(SubmitForm(EditForm1)). It was throughing a message like "An entry is required or has invalid value. Please correct and try again" and also in the below of the field message like " Field MyField3 is required ".

How to control this? I don't need to show this message. for that I have made MyField3DataCard.required = false. But again the message is generating.

 

with regards,

user237.

 

Hi @User237 ,

 

1. Yes, you can, but you have to modify the Items property of Form as follows to avoid the issue like UpdateIf() code.

 

LookUp('[MyTable]',Myfield1=varMyfield1)

 

2. Only change the required property of data card is not enough, please go to SharePoint list setting to see if the Field3 is required, if so, change that field to optional.

Hope this helps.

Sik

View solution in original post

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 (20,722)