Search.../

moveTaskAfter( )

Moves a task specified by ID to be placed after another task in the display.

Description

You can reposition a task to be first in the display by ommitting beforeTaskId.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function moveTaskAfter(taskId: string, options: MoveTaskAfterOptions): Promise<void>

moveTaskAfter Parameters

NAME
TYPE
DESCRIPTION
taskId
string

The task ID to move.

options
Optional
MoveTaskAfterOptions

Options for moving the task.

Returns

Return Type:

Promise<
void
>

Was this helpful?

Update the display order of tasks (dashboard page code)

This function moves a specified task to be displayed after another task using the moveTaskAfter() function.

Copy Code
1
2import { tasks } from 'wix-crm.v2';
3
4/* Sample taskId value:
5 * '37c2c378-8085-4ef7-8a3e-6f341248e757'
6 *
7 * Sample options value:
8 * {
9 * beforeTaskId: '3a49f901-62d5-4ca2-a8e8-395c562a3f7b'
10 * }
11 */
12
13export async function myMoveTaskAfterFunction(taskId, options) {
14
15 try {
16 await tasks.moveTaskAfter(taskId, options);
17
18 console.log('Successfuly updated task display.');
19 } catch (error) {
20 console.log(error);
21 // Handle the error
22 }
23}
24
Update the display order of tasks (export from backend code)

This function moves a specified task to be displayed after another task using the moveTaskAfter() function.

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { tasks } from 'wix-crm.v2';
3import { elevate } from 'wix-auth';
4
5/* Sample taskId value:
6 * '37c2c378-8085-4ef7-8a3e-6f341248e757'
7 *
8 * Sample options value:
9 * {
10 * beforeTaskId: '3a49f901-62d5-4ca2-a8e8-395c562a3f7b'
11 * }
12 */
13
14export const myMoveTaskAfterFunction = webMethod(Permissions.Anyone, async (taskId, options) => {
15
16 try {
17 const elevatedMoveTaskAfter = elevate(tasks.moveTaskAfter);
18 await elevatedMoveTaskAfter(taskId, options);
19
20 console.log('Successfuly updated task display.');
21 } catch (error) {
22 console.log(error);
23 // Handle the error
24 }
25});
26
Move a task to the top of the display.

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { tasks } from 'wix-crm.v2';
3import { elevate } from 'wix-auth';
4
5/* Sample taskId value:
6 * '37c2c378-8085-4ef7-8a3e-6f341248e757'
7 */
8
9export const myMoveTaskAfterFunction = webMethod(Permissions.Anyone, async (taskId) => {
10
11 try {
12 const elevatedMoveTaskAfter = elevate(tasks.moveTaskAfter);
13 await elevatedMoveTaskAfter(taskId);
14
15 console.log('Moved task to top of display');
16 } catch (error) {
17 console.log(error);
18 // Handle the error
19 }
20});
21