If users require an action to close a task without going through the edit page, and also want to make sure that task contains the due date before it is completed, then they can create a new action for the Task object.
To create a new action:
- Go to Task Buttons, Links, and Actions from object management settings for activities.
- Click New Action and select Action type as Update a Record.
- In label type Closing task and then Save.
- Select the fields you want to make required or read-only. In this example, the Due date is made required.
- In this example, predefined value of status field is set to Completed.
- After saving the quick action, you can add predefined field values for any of the fields. In this example, predefined value for task status is set to Completed.
- Add this action to the Task page layout for users.
window.open(URL) along with some variables to redirect users to another page. Most
of these use cases can be achieved instead through custom URL buttons in Lightning
Apex triggers are an another alternative which can also be set up to execute before or after a user clicks Save on a record.