Add/Edit/Delete Service Desk Data

Add/Edit/Delete Service Desk Data

SDP.get(options) 

Fetch the widget data such as URLs, or any input data in the custom widget from the server. You can also perform a cross portal call from the custom widget using this function. Note that only SDP V3 APIs can be invoked using this function.

Example: Access a request present in the IT Portal using its URL to the HR Portal.

Parameters:
Name
Type
Description
options*
Object
Object which contains api details.
Property
Type
Description
url*
String
Mention only the entity URL. The API context will be set automatically. 

input_data
Object
Specify the input data to be passed in the API call. Refer API documentation for input_data format.

portalid
Long
Specify the instance ID to invoke cross-portal calls.
 
* - Mandatory parameter

Returns:
Promise - Resolved with API Success or Rejected with API Failure. Refer API documentation for success/failure response formats.

Syntax:
  1. SDP.get(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.get({
url: "/requests"
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
//Refer API documentation for success response.
//Refer API documentation for failure response.
 

SDP.add(options)

Add data to the server from the custom widget.  You can also perform a cross portal call from the custom widget using this function. Note that only SDP V3 APIs can be invoked using this function.
 
Parameters:
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
url*
String
Mention only the entity URL. The API context will be set automatically.
input_data
Object
Specify the input data to be passed in the API call. Refer API documentation for input_data format.
portalid
Long
Specify the instance ID to invoke cross-portal calls.
 
* - Mandatory parameter

Returns:
Promise - Resolved with API Success or Rejected with API Failure. Refer API documentation for success/failure response formats.

Syntax:
  1. SDP.add(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.add({
url: "/requests",
input_data: {
request: {
subject: 'Request created from Widget'
}
}
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
//Refer API documentation for success response.
//Refer API documentation for failure response.
 

SDP.edit(options) 

Edit data in the server from the custom widget by mentioning the entity ID.  You can also perform a cross portal call from the custom widget using this function. Note that only SDP V3 APIs can be invoked using this function.
You can also perform bulk-editing using this function.
 
Parameters:
Name
Type
Description
options*
Object
Object which contains API details.

Property
Type
Description
url*
String
Mention only the entity URL. The API context will be set automatically.
input_data
Object
Specify the input data to be passed in the API call. Refer API documentation for input_data format.
portalid
Long
Specify the instance ID to invoke cross-portal calls.
 
* - Mandatory parameter

Returns:
Promise - Resolved with API Success or Rejected with API Failure. Refer API documentation for success/failure response formats.

Syntax:
  1. SDP.edit(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.edit({
url: "/requests/100000000000032746",
input_data: {
request: {
subject: 'Request created from Widget'
}
}
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
//Refer API documentation for success response.
//Refer API documentation for failure response.
 
 

SDP.del(options) 

Delete data in the server from the custom widget by mentioning the entity ID.  You can also perform a cross portal call from the custom widget using this function. Note that only SDP V3 APIs can be invoked using this function.
Info
Currently, you can use this function to delete only custom module entities in ServiceDesk Plus MSP Cloud. 
 
Parameters:
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
url*
String
Mention only the entity URL. The API context will be set automatically.
ids
String
Entity Id. Multiple ids can be passed as a comma separated string.
portalid
Long
Specify the instance ID to invoke cross-portal calls.
 
* - Mandatory parameter

Returns:
Promise - Resolved with API Success or Rejected with API Failure. Refer API documentation for success/failure response formats.

Syntax:
  1. SDP.del(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.del({
url: “/cm_webtab/100000000000032739”
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
//Refer API documentation for success response.
//Refer API documentation for failure response.
 

SDP.refreshPage()

Refreshes the page where the widget is loaded. Note that only the page body is loaded, the application header remains untouched.

Example: If the API is called from the right panel widget in a request, request details page completely reloads.
Returns:
Promise - Resolved with Success or Rejected with Failure.

Syntax:
  1. SDP.refreshPage();
 
SDP.refreshPage() call reloads the page which in turn unloads the widget from window. Hence callback is not needed for this API.

SDP.showIndicator(options)

Displays the indicator on the application window after an operation is completed.
 
Parameters:
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
category*
String
Defines the category of the indicator.
Possible categories: success/failure/info/loading
message
String
The message or information to be displayed in the indicator. This is mandatory except for Loading indicators.
timeout
Integer
Defines the amount of time in milliseconds for which the indicator is displayed. You can define up to 5000 milliseconds.
This parameter is applicable to all category indicators except for the Loading indicator, which will be displayed until the SDP.hideIndicator(indicator_type) is called.
 
* - Mandatory parameter

Returns:
Promise - Resolved with Success or Rejected with Failure.

Syntax:
  1. SDP.showIndicator(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.showIndicator({
message: “Used added”
category: “success”
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
“message”: “Indicator displayed”
}
{
“message”: “message is not passed from the widget”
}
 
//Success response will be received when the user clicks the action button.
 

SDP.hideIndicator(indicator_type) 

Hides the displayed indicator.
 
Parameters:
Name
Type
Description
indicator_type
String
Defines the type of indicator to be hidden. If indicator_type is not passed, indicators or any indicator_type will be hidden.
Possible indicator_types: message/loading.
 
Returns:
Promise - Resolved with Success or Rejected with Failure.

Syntax:
  1. SDP.hideIndicator(indicator_type).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.hideIndicator({
indicator_type: “message”
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
“message”: “Indicator hidden
}
{
“message”: indicator_type is not valid”
}
 

SDP.showAlert(options)

Displays an alert box when an action is performed in the widget.
 
Parameters
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
title
String
Defines the title of the alert box. Default title - “Alert”.
message*
String
The message or information to be displayed in the alert box.
action
String
Defines the action button text. Default text - “Ok”.
 
* - Mandatory parameter

Returns:
Promise - Resolved with Success or Rejected with Failure. Success response will be received when the user clicks the action button.

Syntax:
  1. SDP.showAlert(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.showAlert({
title: “Connection Info”,
message: “Win2 connection has been selected.”,
action: “Ok
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
“index: “0”
}
{
“message”: “message cannot be null”
}
 

SDP.showConfirm(options)

Displays a confirm dialog box when an action is performed in the widget.
 
Parameters
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
title
String
Defines the title of the confirm dialog. Default title - “Alert”.

message*
String
The message or information to be displayed in the confirm dialog.

mode
String
Mode is used to change the style of the alert box. 

Supported mode: attention. 

Attention mode is mainly used to render warnings and alert themes.
confirm
Array
Renders the passed string as action buttons - Confirm and Cancel. The buttons will be rendered in RTL order. The primary action button will be styled according to the current application theme.

If 'confirm' property is not passed,
  1. The default “Yes” and “No” text will be rendered for the action buttons.
  2. If attention mode is passed, “Confirm” and “Cancel” will be rendered in the warning theme.
 
* - Mandatory parameter

Returns:
Promise - Resolved with Success or Rejected with Failure. Success response will be received when the user clicks the action button and contains the index of the action button.

Syntax:
  1. SDP.showConfirm(options).then(function(response) {
  2. console.log(response);
  3. }).catch(function(response) {
  4. console.log(response);
  5. });
 
Sample:
API Call
Success Response
Failure Response
SDP.showConfirm({
title: “Delete User”,
message: “Do you want to delete selected requester(s)?”,
confirm: [“Delete”, “Cancel”]
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
“index: “0”
}
{
“message”: “message cannot be null”
}

    • Related Articles

    • Service Request Workflow Editor

      The Workflow Editor enables you to build a directional pathway for the service request to follow through its life cycle. The workflow editor is provided with an expandable, scrollable canvas for creating workflow diagrams and a collapsible stencil ...
    • Edit or Delete Customers

      Role Required: SDAdmin Edit Customer Details Go to the Customers module. On the list view, click displayed on the customer and select Edit. Make changes to the Edit Customer form and click Save. Alternatively, you can access the Edit button on the ...
    • Service

      Add services provided or availed by the organization. You can categorize services having similar functionalities or purposes under the service type. After creating a service, you can associate vendors who provide or avail the service. Role Required: ...
    • Edit Requests

      Role Required: Technicians with permission to edit requests Edit an Individual Request Go to Requests and choose the respective customer from the drop-down in the header. Open the request that you want to edit. Click Edit at the top of the page to ...
    • Edit or Delete Problems

      Edit Problems On the list view or template view, click beside a problem and select Edit. Alternatively, go to the problem details page and click Edit on the toolbar. You can also perform an inline edit in the problem request details by clicking on a ...