Hello! I am looking for some assistance.
I have a Power App that allows users to enter a safety activity. The safety activity is a choice field with 6 different options. They can enter each activity once every 7 days. When they submit the form, it starts a flow that goes through an approval process. Right now, the first part of the approval process is manual to check if they have submitted that activity in the last 7 days.
I would like to make that part automated either in Power Apps or Flow. I tried creating a view on the Sharepoint list for the last 7 days. I was able to create a flow and get items based on that view. I was planning on having it count is the safety activity count is greater than 1, but it does not work since it is a choice field.
Any suggestions would be appreciated!
Solved! Go to Solution.
That was the idea the the else bit
With(
{
wList:
Filter(
YourActivityListName,
YourDateField,
Descending
)
},
If(
DateDiff(
Lookup(
wList,
YourUserField=User().Fullname
).YourDateField,
Today()
) < 7,
Notify("You have an activity in the last 7 days")
),
SubmitForm(YourFormName)
)
This will either give the message or submit the form.
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.
Hi @JennyinIndy ,
Assuming you have the user's name and the date of the last Activity in your list, you would do something like this
With(
{
wList:
Filter(
YourActivityListName,
YourDateField,
Descending
)
},
If(
DateDiff(
Lookup(
wList,
YourUserField=User().Fullname
).YourDateField,
Today()
) < 7,
Notify("You have an activity in the last 7 days")
)
)
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.
Thank you. Would I add this code to the onsubmit field?
I cannot see your model, but you would generally put this before your save code, with the save being the "else" at the end.
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.
Hi @JennyinIndy ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
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.
Thanks for responding.
In your example above
Submitter would be the user field.
Event Date would be the date field.
Safety Activity could be one of several choices. Attend Safety Training and Instruct Safety Training would be two of the choices. They can both attend and instruct safety training once every 7 days. They would not be able to attend safety training twice in 7 days.
After they get notified that they have already completed that activity, is there a way to keep them from submitting the form until they change it?
Thank you,
Jenny
That was the idea the the else bit
With(
{
wList:
Filter(
YourActivityListName,
YourDateField,
Descending
)
},
If(
DateDiff(
Lookup(
wList,
YourUserField=User().Fullname
).YourDateField,
Today()
) < 7,
Notify("You have an activity in the last 7 days")
),
SubmitForm(YourFormName)
)
This will either give the message or submit the form.
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.
User | Count |
---|---|
125 | |
87 | |
87 | |
75 | |
69 |
User | Count |
---|---|
215 | |
181 | |
140 | |
97 | |
83 |