Need to stop submit timecards on project tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 12:27 AM
Hello,
Some end users are able to submit the timecards on project tasks. We need to restrict to submission of the time cards when the project task is closed. if we restrict, does it affect any other functionalities?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 01:44 AM
Hi @Rama Rao
Let's define a Before Business Rule in the Time Card [time_card] table.
Then you can validate the associated Task, if the task is a Project Task and it's already closed.
Then abort the action.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 07:27 AM
Hello @Tai Vu ,
If we create before the business rule, does it affect any other functionalities?
And How do restrict from the timesheet portal? Can you help me with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2023 08:01 PM - edited 11-12-2023 08:04 PM
Hi @Rama Rao
In this scenario, the Business Rule functions as a server-side validation. Therefore, it will be enforced before the data gets inserted into the Time Card [time_card] table, whether through the portal or the native UI.
This validation is an additional layer before data alterations, so I don't foresee any impact on other functionalities here. However, it's essential to conduct thorough testing to ensure everything runs smoothly.
Sample below.
(function executeRule(current, previous /*null when async*/) {
current.setAbortAction(true);
gs.addErrorMessage("The Project Task is already closed");
})(current, previous);
And if you'd like to filter out the inactive tasks in the Select a Task list on the portal, you need to do some customization in the widget "Time Card Grid [tc-grid]".
URL: https://<instance_name>/sp_widget.do?sys_id=191df3b393332200ea933007f67ffbab
In the Link box, at line 385 => task-selector, you can re-define the sysparm_query to your own filter.
Cheers,
Tai Vu