How to send cancel notification whe assigned to changes

Ajay Singh2
Tera Contributor

If the CTASK ‘Assigned to’ value changes from Person A to Person B; Person A receives an cancel notification and Person B receives a new notification.

 

 

Thank You

1 ACCEPTED SOLUTION

Deepak Shaerma
Kilo Sage

Hi @Ajay Singh2 
Create a Business Rule, Before Update
Table = sc_task
condition = person field changes

 

 var previousAssignedTo = previous.assigned_to.getDisplayValue();
    var newAssignedTo = current.assigned_to.getDisplayValue();
    
    // If the Assigned to value has changed, handle notifications
    if (previous.assigned_to != current.assigned_to) {
        
        // Send cancel notification to the previous assignee
        if (previous.assigned_to) {
            gs.eventQueue('task.assigned_to.canceled', current, previous.assigned_to, previousAssignedTo);
        }
        
        // Send new notification to the new assignee
        if (current.assigned_to) {
            gs.eventQueue('task.assigned_to.new', current, current.assigned_to, newAssignedTo);
        }
    }

 

Please update the script according to correct field and names.

Step 2: Create Notifications for the Events
1. Navigate to System Notification> Email > Notifications.

#### For Cancel Notification:
Configure the notification with the following properties:

Name: e.g., “Assignment Cancel Notification”
Table: Choose the appropriate table (for example, Change Task).
When to send: Event is fired
Event name: task.assigned_to.canceled

#### Who will receive:
Users/Groups in fields: event.parm1 (this is where the previous assignee should be identified)

#### Email content:
- Subject: “Assignment Cancelled”
- Message HTML: “Your assignment on task [task number or other info] has been cancelled.”

#### For New Assignment Notification:
Configure the notification with the following properties:

Name: e.g., “New Assignment Notification”
Table: Choose the appropriate table (for example, Change Task).
When to send: Event is fired
Event name: task.assigned_to.new

#### Who will receive:
Users/Groups in fields: event.parm1 (this is where the new assignee should be identified)

#### Email content:
- Subject: “New Task Assignment”
- Message HTML: “You have been assigned a new task: [task number or other info]”

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma 






View solution in original post

1 REPLY 1

Deepak Shaerma
Kilo Sage

Hi @Ajay Singh2 
Create a Business Rule, Before Update
Table = sc_task
condition = person field changes

 

 var previousAssignedTo = previous.assigned_to.getDisplayValue();
    var newAssignedTo = current.assigned_to.getDisplayValue();
    
    // If the Assigned to value has changed, handle notifications
    if (previous.assigned_to != current.assigned_to) {
        
        // Send cancel notification to the previous assignee
        if (previous.assigned_to) {
            gs.eventQueue('task.assigned_to.canceled', current, previous.assigned_to, previousAssignedTo);
        }
        
        // Send new notification to the new assignee
        if (current.assigned_to) {
            gs.eventQueue('task.assigned_to.new', current, current.assigned_to, newAssignedTo);
        }
    }

 

Please update the script according to correct field and names.

Step 2: Create Notifications for the Events
1. Navigate to System Notification> Email > Notifications.

#### For Cancel Notification:
Configure the notification with the following properties:

Name: e.g., “Assignment Cancel Notification”
Table: Choose the appropriate table (for example, Change Task).
When to send: Event is fired
Event name: task.assigned_to.canceled

#### Who will receive:
Users/Groups in fields: event.parm1 (this is where the previous assignee should be identified)

#### Email content:
- Subject: “Assignment Cancelled”
- Message HTML: “Your assignment on task [task number or other info] has been cancelled.”

#### For New Assignment Notification:
Configure the notification with the following properties:

Name: e.g., “New Assignment Notification”
Table: Choose the appropriate table (for example, Change Task).
When to send: Event is fired
Event name: task.assigned_to.new

#### Who will receive:
Users/Groups in fields: event.parm1 (this is where the new assignee should be identified)

#### Email content:
- Subject: “New Task Assignment”
- Message HTML: “You have been assigned a new task: [task number or other info]”

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma