Best way to log time on a task

Using Fibery for 2 months now as a CRM , invoicing and project management tool, I really like the ability to customize the model to our exact needs and have plenty of ways for playing with the data.
But sometimes, I don’t find a convenient way for inputting some data and that’s the case for recording time spent on tasks.

The model is quite basic : some tasks with time records by users…
Currently, I

  1. open the task, go to the ‘time records’ section,
  2. click on the “link or create”… but I have usually no name to put in, I just want to create a new record and edit it. As it is today, you cannot add a record without name this way. It would be helpful to force record creation without name (via ctrl + enter ?). Typing a space is very dangerous, as you are linking to the first unnamed record and so changing it related task. Not what you want.
    So I type a “a” or other random letter. The time entry is added but very small since the name is not displayed
    image
  3. I click on this new line
  4. set the current date
  5. set the user (me)
  6. input the time spent

Thanks to the new feature of action button with formulas, I created a “add time” button on the task entity that add a time entry on the task with the date as today() but I didn’t find a way to set the user as “me” and I still have to go to the “times” section of the task, click on the last line and input the time spent.
Ideally, I would like to trigger a popup for inputting the time spent before creation or perhaps open directly the newly created entity (but that would not be possible for batch actions on multiple task entities).

I also tried to create time entries from a calendar view but there is also the issue of required “name” that makes it not practical either.

If someone has the same situation, I would really like to know its process. Thank you

Sylvain

1 Like

So, I think that to do what you want, you’d have to use the action script and do it manually. Since there is no popup capability at this point, you could have a button for adding some pre-defined time units. Like “Log 30 Minutes”, “Log 1 Hour”, and so on… then have the user click multiple times. All of the rest should be able to be accounted for in the action script from what I can tell. Have you tried using that approach yet?

Edit: Since you don’t need the name, I’d use a formula to set it to a combination of the attributes and parent task name so you don’t have lots of near duplicate records showing up

2 Likes

Here is the proposed approach:


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:

// 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

Hi Nick, thanks for your answer.
I think you’re right : at the moment, there is no way to get the currentUser by formula.

But the most difficult part is the duration input. I cheated a little, and activated the “automation rules”. Thanks to that I was able to create a trigger on time record creation and parse the name for duration input ? I also played a bit further to add the user and date only if not already filled.

Here is the script

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    console.log({entity})
    const patch = {
        'Temps passé': parseFloat(entity.name),
    }
    if (!(entity["User"] && entity["User"].Id)) {
        patch["User"] = entity["Created By"].Id
    }
    if (!entity["Date"]) {
        patch['Date'] = new Date().toISOString()
    }
    await fibery.updateEntity(entity.type, entity.id, patch);
}

I’m sure all of this will be easier in the futur but in case it can help right now

1 Like

You don’t want to track time cumulatively on the task as you’re working on it?

image

Regarding assigning to you, are you familiar with this?

That is essentially the same concept I pasted in my reply here, except the challenge was that @Sylvain_Vuilliot didn’t need to assign the Task. He wanted to assign the time record he just created and is associated with the task. To use the linked button, he’d have to open the Time Record entity after creating it, then trigger the button.

As for tracking the time while working, I think that could also be a little bit more complicated here, because it sounds like multiple people could log time on the same Task. So, if multiple people are working at the same time on it, the real-time tracking would need to handle it through related time records as well, rather than directly on the task. However, that approach could avoid the whole problem of not having an easy way to enter in the exact time worked. I do think my solution could be adapted to use that kind of approach without too much additional effort though.

Edit: might be helpful for anyone else to understand visually what is being done. @Sylvain_Vuilliot ended up with a little different solution to parse the title, but the idea is to have a task with multiple time records associated, where each is associated with who entered it. That association is not possible via any automation at this point besides with a script.

Here is the Task we want to log time on:

With one click of the button, an additional record is added to Time Records associated with me. The total time is aggregated from the time records, rather than adding it to a field directly on the Task.

What you could do is modify my example to add the time record if there already isn’t one for the current day associated with the user and start the timer on the time record, rather than the task. Then stop it from the task, which would then go and find your associated time record and update the duration.

1 Like

Got it, looks good.

I thought we could create formulas as an entity name? Wouldn’t that solve the need to name a new record?

Yeah, that is what I did in my example “Time Logged for HTML Coding (task name)…”. The nice thing about having unique calculated names is it wouldn’t impact search as much. However, @Sylvain_Vuilliot had a different solution where he is putting in the duration into the name field, then using automation to parse out the duration amount. This makes it easier to quickly add any specific duration as needed.

1 Like