# Best way to log time on a task

**URL:** <https://community.fibery.io/t/best-way-to-log-time-on-a-task/1715>\
**Category:** Get Help\
**Created:** [June 22, 2021, 8:57am UTC](https://community.fibery.io/t/best-way-to-log-time-on-a-task/1715 "2021-06-22T08:57:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [June 22, 2021, 12:36pm UTC](https://community.fibery.io/t/best-way-to-log-time-on-a-task/1715/3 "2021-06-22T12:36:04Z")

</div>

Here is the proposed approach:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/02df2ee52ca64a39ce4b635bc30cb6fd57e91ba4.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/e6ec478c2ac408f12dc7d15b80de0500283cd8d6.png)

Name formula on the time record field could optionally be something like this:

`"Time Logged for " + Task.Name + " by " + User.Name + " on " + ToText(Date) + " (" + ToText(Duration) + ")"`

Button action script would be:

```auto
// Developer reference is at api.fibery.io/#action-buttons

// Fibery API is used to retrieve and update entities
const fibery = context.getService('fibery');
const today = new Date();
// affected entities are stored in args.currentEntities;
// to support batch actions they always come in an array
for (const entity of args.currentEntities) {
    const offersTask = await fibery.createEntity('Project Management/Time Record', {
        "User": args.currentUser.id,
        "Task": entity.id,
        "Date": today.toISOString(),
        "Duration": 0.5
    });
}

```

Link to the template: [Project Management with Time Records](https://shared.fibery.io/t/b464daee-62ec-4718-a1ad-1bebddf018d1-project-management)

---

_[View the full topic](https://community.fibery.io/t/best-way-to-log-time-on-a-task/1715)._
