Salesforce Time Logger



I saw similar question is some cases - we want to allow the user to report working hours directly in Salesforce.

Each implementation usually has unique specification, so I will share here the basic concept that can be used as basic and then customized/extended.


General idea is a custom component where user can report their hours + and optional component for manager to assign users with total hours they allowed to report. 

Therefore, it can be use in either way:

  • Placing Time Log component in record page and setting the property 'use assignment' to false,  allowing users to report hours on the record without limitation.
  • Placing Time Log component in the record page + Time Log Assignment (expose it for relevant users) and set 'use assignment' to true. This way, users can report hours only if they were assigned to.


Notice, we can add in the object Time Log lookup field for the object you want to links the reported hours and this will automatically populated. This way can use the standard components to display logs related list.

in the record page, without the lookup field only the the field Related_Record_Id will be set which is just an text field.


Rollups?

Common request with such functionality is to have rollup from the time logs to the parent object. For such request will need to set the lookup field in Time Log as suggest above.

Might consider the following points:

-In case it will be used only for 1 object, can simply set the relation to the object as master/detail and use build-in rollup summary fields.

-In case it will be used for few objects and there are several rollups needed might replicate the Time Log object per each case (Time Log Opportunity, Time Log Case...) and still use the mater/detail relation and the rollup fields.

-In other cases, were we ending with the lookup relation field, will need to handle the rollup calculations with customization.


Full code can be found in git:

https://github.com/liron50/shared-code/tree/main/timelog

No comments:

Post a Comment

Retire of Permission on Profiles

If you are working as a Salesforce admin/developer you've probably heard somewhere that Salesforce is planning to make a significant cha...