cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nina2021
Helper I
Helper I

Update status when submitting form

Hello all,

 

I am building an app using Dataverse and I am trying to update the status column to "submitted" when the user successfully submits a request.

 

Here's my formula :

If
(IsBlankOrError(Form3) Or IsEmpty(DataCardValue18.Attachments); // if compulsory fields are missing or in error
Notify("Champs manquants, veuillez compléter tous les champs obligatoires";Error;4000); // then do not submit form and notify error
SubmitForm(Form3) && UpdateContext({Statut de la demande : "Soumise"}) && Navigate(Succès) && ResetForm(Form3)) // otherwise submit form and show success screen

 

I'm using update context but it has no impact on the status.

 

Thanks in advance !

10 REPLIES 10
WarrenBelz
Super User
Super User

Hi @Nina2021 ,

Try this syntax

If(
   IsBlankOrError(Form3) ||
   IsEmpty(DataCardValue18.Attachments); 
   Notify(
      "Champs manquants, veuillez compléter tous les champs obligatoires";
      Error;4000
   );
   SubmitForm(Form3);;
   UpdateContext({Statut de la demande : "Soumise"});;
   Navigate(Succès);;
   ResetForm(Form3)
)

 

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.

Nina2021
Helper I
Helper I

Hello @WarrenBelz ,

 

Thanks for your reply.

 

I tried that but it didn't work. The UpdateContext formula doesn't seem to recognise my column. I tried with the default name (cr6fa_statutdelademande) and the screen name (Statut de la demande) but in both cases, it doesn't recognise the field.

 

Thanks !

Hi @Nina2021 ,

What are you trying to do with UpdateContext here? It sets a Variable, not a field or control value. Are you trying to change the value of your field after you submit the form?

Hi @WarrenBelz ,

 

Thank you for that info. UpdateContext might not be the correct function then. 

 

What I am trying to do is quite basic actually : when a user submits a form, the status of his/her request switches from "draft" to "submitted for approval". Then, when his/her manager approves the request, the status switches from "submitted for approval" to "approved".

 

Thanks !

Hi @Nina2021 ,

I am not a DataVerse user (this is much easier in SharePoint), but try this

If(
   IsBlankOrError(Form3) ||
   IsEmpty(DataCardValue18.Attachments); 
   Notify(
      "Champs manquants, veuillez compléter tous les champs obligatoires";
      Error;4000
   );
   SubmitForm(Form3);;
   Patch(
      YourTableName;
      Form3.LastSubmit;
      {Statut de la demande:"Soumise"}
   );;
   Navigate(Succès);;
   ResetForm(Form3)
)

 

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.

Hello @WarrenBelz ,

 

I think that the Patch function isn't working properly for Dataverse. I keep having error issues with it.

 

Thank you for your help !

@Nina2021 ,'

Do you have a unique ID for the record - if so what is its name?

Hi @WarrenBelz ,

 

Yes I do. It's the timesheet number. It's generated automatically when the timesheet is created.

Thanks @Nina2021 ,

Instead of Form3.LastSubmit, put (change if field name wrong)

{TimeSheetNo:Form3.LastSubmit.TimesheetNo}

 

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.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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