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
12import { tasks } from 'wix-crm.v2';34/* Sample taskId value:5 * '37c2c378-8085-4ef7-8a3e-6f341248e757'6 *7 * Sample options value:8 * {9 * beforeTaskId: '3a49f901-62d5-4ca2-a8e8-395c562a3f7b'10 * }11 */1213export async function myMoveTaskAfterFunction(taskId, options) {1415 try {16 await tasks.moveTaskAfter(taskId, options);1718 console.log('Successfuly updated task display.');19 } catch (error) {20 console.log(error);21 // Handle the error22 }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';45/* Sample taskId value:6 * '37c2c378-8085-4ef7-8a3e-6f341248e757'7 *8 * Sample options value:9 * {10 * beforeTaskId: '3a49f901-62d5-4ca2-a8e8-395c562a3f7b'11 * }12 */1314export const myMoveTaskAfterFunction = webMethod(Permissions.Anyone, async (taskId, options) => {1516 try {17 const elevatedMoveTaskAfter = elevate(tasks.moveTaskAfter);18 await elevatedMoveTaskAfter(taskId, options);1920 console.log('Successfuly updated task display.');21 } catch (error) {22 console.log(error);23 // Handle the error24 }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';45/* Sample taskId value:6 * '37c2c378-8085-4ef7-8a3e-6f341248e757'7 */89export const myMoveTaskAfterFunction = webMethod(Permissions.Anyone, async (taskId) => {1011 try {12 const elevatedMoveTaskAfter = elevate(tasks.moveTaskAfter);13 await elevatedMoveTaskAfter(taskId);1415 console.log('Moved task to top of display');16 } catch (error) {17 console.log(error);18 // Handle the error19 }20});21