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

Not able to properly update a record using updateContext

So, I have a context variable that is a record saved when you select an item from a gallery. here is the code:

Navigate('Edit Ticket', ScreenTransition.Fade, { itemToEdit: Gallery9.Selected, IsEditSelected:true });
ViewForm(EditForm3);

All good and fine, when the form is loaded the info is there as ThisItem Item in the form is set to "itemToEdit".
Problem is that I have a button that when clicked should update itemToEdit.Status, which is a choice field from sharepoint list.
So if I try to use UpdateContext with Patch:

UpdateContext({ itemToEdit: Patch(itemToEdit, { 'Status': { Value: "In Progress" } }) }) 

 

After that the form simply breaks, I can't view the data and the patch won't work either. Are there any other ways to do that (update status) instead of creating a separated variable just for the Status?

Changing the choice directly from the form would also work for me. Just not sure how yet.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @rssilvaba ,

You cannot Patch a Variable - only a Collection or Table/List. I will give you a start on this as below. First part

Navigate(
   'Edit Ticket', 
   ScreenTransition.Fade,
   {IsEditSelected:true}
);
ClearCollect(
   colEditItem,
   Gallery9.Selected
)

and the second

Patch(
   colEditItem,
   First(vEditItem),
   {
      'Status':
      {
         Value: "In Progress"
      } 
   }
)

The Item for your form would be

First(colEditItem)

 

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.

 

View solution in original post

1 REPLY 1
WarrenBelz
Super User III
Super User III

Hi @rssilvaba ,

You cannot Patch a Variable - only a Collection or Table/List. I will give you a start on this as below. First part

Navigate(
   'Edit Ticket', 
   ScreenTransition.Fade,
   {IsEditSelected:true}
);
ClearCollect(
   colEditItem,
   Gallery9.Selected
)

and the second

Patch(
   colEditItem,
   First(vEditItem),
   {
      'Status':
      {
         Value: "In Progress"
      } 
   }
)

The Item for your form would be

First(colEditItem)

 

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.

 

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

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

Top Solution Authors
Top Kudoed Authors
Users online (58,576)