# Create new action

<!-- -->

1. Let's imagine sometimes timelog doesn't have enough information about what was done and need to be elaborated.
2. For this let's create a new action called "Elaborate".
3. In VS Code - open the file **actions/index.ts** and add one more action at the end:

actions/index.ts

```
{
		caption: 'Elaborate',
		description: 'Ask developer for more details about this timelog',
		options: {
			showAsButton: false,
			viewMode: 'local',
			visible: true,
		},
		priority: 1,
		uid: 'elaborate',
	},
```

4. Install the app - this will show additional button on timelog.

\[image: Timelog form showing the Elaborate action button in the actions menu]

5. Imagine we need to allow this action only for the workspace admin, this can be achieved by adding a precondition:

actions/index.ts

```
{
		caption: 'Elaborate',
		description: 'Ask developer for more details about this timelog',
		options: {
			showAsButton: false,
			viewMode: 'local',
			visible: true,
		},
		precondition: `currentUser.isWorkspaceAdmin`,
		priority: 1,
		uid: 'elaborate',
	},
```

6. This button can be now clicked - but nothing valuable happens. As an example - upon clicking this button - let's create a new task for the user asking for timelog elaboration.
7. In VS Code - open the file **actions/logic/index.ts** and add such a method.

actions/logic/index.ts

```
elaborate() {
		const newTask = ComindServer.createAppRecord('TASK', {
			accountable_account_id: currentUser.id,
			keeper_id: entity.accountable_account_id,
			priority: 'low',
			refer_task_id: entity.id,
			title: `Need more details about timelog #${entity.number}`,
		});
		entity.comment = `Requested elaboration about this timelog in task #${newTask.number}`;
	}
```

8. Publish the app, then go to some timelog and click "Elaborate" button. Upon clicking a new task will be created.

![Newly created task record with the title referencing the timelog number](/assets/images/task-for-timelog-3c7cfe6eaf7e1a54831ca72727dafaae.png)

For a full reference on action definitions, action logic, preconditions, and bulk operations, see [Actions](/developer-guide/building-blocks/actions.md).
