Hello,
My objective is as follows:
If EditForm mode == Edit, then do nothing
If EditForm mode == New, then create a record
Therefore, I have written following formula:
If(EditForm.Mode=FormMode.Edit,"",Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})); --> It's not working
If(EditForm.Mode=FormMode.New,Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})); -->It's not working
Can you please share where I am wrong here?
Thanks,
Solved! Go to Solution.
While checking on this further, I see that If condition is not working because:
FormMode is returning "0" value if FormMode == New and Edit, there is no differentiation between New and Edit, therefore if condition is not working out.
Therefore, now I have declared variable called EditFormMode, if NewForm mode is navigated, then EditFormMode = 1, If Edit form mode is navigated then EditFormMode = 0
and using the following formula, which is working as expected:
If((EditFormMode = 1),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'}))
Thank you!
Hi @dave8 ,
Try this:
If(!(yourformanem.Mode = FormMode.Edit),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'}))
If((yourformanem.Mode = FormMode.Edit),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'}));
Proud to be a Super User!
Regards,Hi @KrishnaV
Both are not working as it should:
If(!(yourformanem.Mode = FormMode.Edit),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})) - This doesn't patch, if FormMode is New
If((yourformanem.Mode = FormMode.Edit),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})); - This does patch regardless if FormMode is Edit
While my requirement is, It should only patch if FormMode = New
I then try with following formulas:
If(!(yourformanem.Mode = FormMode.New),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})) - This does patch regardless if FormMode is New
If((yourformanem.Mode = FormMode.New),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'})) - This does note patch if FormMode is New
How do I patch ONLY if form mode == New?
Thanks,
While checking on this further, I see that If condition is not working because:
FormMode is returning "0" value if FormMode == New and Edit, there is no differentiation between New and Edit, therefore if condition is not working out.
Therefore, now I have declared variable called EditFormMode, if NewForm mode is navigated, then EditFormMode = 1, If Edit form mode is navigated then EditFormMode = 0
and using the following formula, which is working as expected:
If((EditFormMode = 1),Patch('Updates',Defaults('Updates'),{'Status':'In Progress'}))
Thank you!
Since that the issue is resolved please mark the relevant reply as a solution so that it will help the new members in the community.
Proud to be a Super User!
Regards,Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
172 | |
62 | |
32 | |
31 |
User | Count |
---|---|
338 | |
270 | |
105 | |
72 | |
56 |