Newer Version Available

This content describes an older version of this product. View Latest

declineAgentWork for Lightning Experience

Declines a work item that’s assigned to an agent.

Arguments

Name Type Description
workId string The ID of the work item that the agent declines.
declineReason string The provided reason for why the agent declined the work request.
callback function JavaScript method to call when an agent declines the work item associated with the workId.

Sample Code

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:omniToolkitAPI aura:id="omniToolkit" />
3    <lightning:button label="Decline" onClick="{! c.declineWork }" />        
4</aura:component>

Controller code:

1({
2    declineWork: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.getAgentWorks({
5            callback: function(result) {
6                var works = JSON.parse(result.works);
7                var work = works[0];
8                omniAPI.declineAgentWork({
9                    workId: work.workId,
10                    callback: function(result2) {
11                        if (result2.success) {
12                            console.log("Declined work successfully");
13                        } else {
14                            console.log("Decline work failed");
15                        }
16                    }
17                });
18            }
19        });
20    }
21})

Response

This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following properties:

Name Type Description
success boolean true if declining the work item was successful; false otherwise.