cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ac1drain
Frequent Visitor

Calculated field or Flow?

I'm currently working on a model driven app for employee Offboarding. On my form there are a series of tasks for two groups; lets call them Group A and Group B.

 

When Group A completes all of their tasks and marks them as complete (a series of yes/no fields) - I have a calculated field "Group A Tasks Complete" that gets set to Yes. I'd also like to have a date & timestamp to accompany that so we can track when and how long it took each group to complete their tasks.

 

I tried making a date/time field that is calculated when "Group A Tasks Complete" equals Yes, then set the date/time to =NOW(), but that just gets changed anytime the form is updated. I'm wondering if it's possible to achieve what I'm after with a calculated field, or if I need to create a Flow that triggers when a record is updated and populate the date/time field that way.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisPiasecki
Super User
Super User

Hi @ac1drain,

 

A calculated field doesn't actually store a value, it's a virtual field that is computed whenever the record is retrieved (saving on a form causes a refresh / retrieve).

 

What I would recommend is this:

  • Create a business rule scoped at entity level, have it set a Completed Flag to Yes when all your other fields are set to yes.
  • You can then setup a classic Dataverse real-time workflow that triggers on creation of the record or on update of the Completed flag field.
  • In the workflow add a condition if the Completed Flag is set to yes, set the completed date, using the Process > Execution Time.
  • Add an else condition to clear out the Completed date (meaning the competed flag is no and thus the completed date should be empty).

One final general recommendation I'll make is that it's more useful to use Datetime fields for tracking completion of tasks versus yes/no, as it provides the same functionality but provides better visibility and reporting on your data as you can better identify bottlenecks in your tasks/processes.

 

Yes/No fields are fine for process triggering behavior such as this scenario where you have a Completed Flag. 

 

Hope this helps. 

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

5 REPLIES 5
Prakash4691
Resolver II
Resolver II

Hi @ac1drain ,

 

Calculated field will run every time when click on save button. Expected OOB behavior, calculates only on save. So, if "Group A Tasks Complete" equals Yes then datetime will get update every time while clicking save button.

 

Modify your filter condition, "Group A Tasks Complete" equals Yes  and datetime field should be empty/null/does not contain data then update datetime field to NOW(). That will work.

 

Please mark it as solution. If it answers your question.

 

 

Regards,

Prakash

ChrisPiasecki
Super User
Super User

Hi @ac1drain,

 

A calculated field doesn't actually store a value, it's a virtual field that is computed whenever the record is retrieved (saving on a form causes a refresh / retrieve).

 

What I would recommend is this:

  • Create a business rule scoped at entity level, have it set a Completed Flag to Yes when all your other fields are set to yes.
  • You can then setup a classic Dataverse real-time workflow that triggers on creation of the record or on update of the Completed flag field.
  • In the workflow add a condition if the Completed Flag is set to yes, set the completed date, using the Process > Execution Time.
  • Add an else condition to clear out the Completed date (meaning the competed flag is no and thus the completed date should be empty).

One final general recommendation I'll make is that it's more useful to use Datetime fields for tracking completion of tasks versus yes/no, as it provides the same functionality but provides better visibility and reporting on your data as you can better identify bottlenecks in your tasks/processes.

 

Yes/No fields are fine for process triggering behavior such as this scenario where you have a Completed Flag. 

 

Hope this helps. 

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

Thanks @ChrisPiasecki I'm going to try this out. If I may bother you with one more question -- what's the general consensus on when to use a workflow vs. a flow? The classic UI is telling me to use flow instead of a background workflow.

Hi @ac1drain,

 

For asynchronous (background) workflows, you should user Power Automate cloud flows instead as it suggests.

 

If your workflows need to be synchronous (real-time), then you need to use the classic Dataverse workflow because Power Automate only runs asynchronously. You'll notice if you uncheck the background workflow in the workflow editor that recommendation message will disappear.

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

Thanks @ChrisPiasecki, you've been extremely helpful. With a little fumbling through the classic interface I was able to get it working.

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 (40,245)