Need to stop submit timecards on project tasks

Rama Rao
Tera Contributor

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

3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

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

Rama Rao
Tera Contributor

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?

 
Thanks

 

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.

Screenshot 2023-11-13 at 11.03.40.png

(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.

Screenshot 2023-11-13 at 11.01.09.png

 

Cheers,

Tai Vu