Manage Custom Widgets

Manage Custom Widgets

SDP.openWidget(options) 

Opens a new widget as a pop-up within the custom widget.
 
Parameters:
Name
Type
Description
options*
Object
Object which contains API details.

Property
Type
Description
id*
Long
Indicates the ID of the widget to be opened.
name*
String
Indicates the name of the widget to be opened.
title
String
Sets the title of the popup. If title is not passed, the widget name will be set as the popup title.
data
Object
Specifies the data to be passed to the widget that is opening.
 
* - Mandatory parameter

Info
Either ID or name parameters can be specified as an option to open the widget. If both are specified, only ID will be considered. 

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

Syntax:
  1. SDP.openWidget(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.openWidget({
id: "100000000000032273",
data: {
mode: "new_user"
}
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
message: “Widget opened successfully”
}
{
"message": "Please provide a valid widget id or name with required visibility permissions to render"
}
 

SDP.closeWidget() 

Closes the pop up where the custom widget is loaded. This API is functional only if a widget is opened in a pop-up window, such as menu widget or a widget opened using the SDP.openWidget API.

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

Syntax:
  1. SDP.closeWidget().catch(function(response) {
  2. console.log(response);
  3. });
 
SDP.closeWidget() call’s successful execution closes the widget popup in the window. Hence success callback is not needed for this API.

Sample:
API Call
Failure Response
SDP.closeWidget().catch(function(response) {
console.log(response);
});
{
message: “This requested action is not supported in this view”
}
 

SDP.resizeWidget(options) 

Resize the custom widget popup as needed. The maximum widget size allowed is 1200X800 pixels.
This API is functional only if a widget is opened in a pop-up window, such as menu widget or a widget opened using the SDP.openWidget API.

Parameters:
Name
Type
Description
options*
Object
Object which contains API details.
Property
Type
Description
width*
Integer
Specify the required widget popup width in pixels. Maximum width for popup is 1200 pixels.
height*
Integer
Specify the required widget popup height in pixels. Maximum height for popup is 800 pixels.
 
* - Mandatory parameter
Info
Either ID or name parameters can be specified as an option to open the widget. If both are specified, only ID will be considered. 

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

Syntax:
  1. SDP.resizeWidget(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.resizeWidget({
width: 1000,
height: 500
}).then(function(response) {
console.log(response);
}).catch(function(response) {
console.log(response);
});
{
"message": "Window resized successfully"
}
{
"message": "width is not a valid number"
}

    • Related Articles

    • Custom Widgets List View

      Role Required: SDAdmin You can manage the custom widgets by enabling/disabling widgets, editing widget details, or by managing their display locations from the list view. Enable/Disable Custom Widgets - You can disable custom widgets temporarily to ...
    • Add, Install, & Manage Probes

      Probes are applications installed on a network to fetch the details of the devices present in that network. ServiceDesk Plus MSP Cloud uses probes to fetch asset-related information and requires probes to be installed as a Windows service. Probes ...
    • Custom Menu

      Overview Custom Menu allows you to create customized actions that can be performed on various modules in ServiceDesk Plus MSP Cloud. You can configure actions for a custom menu by using custom functions, custom widgets, or by invoking a URL. The ...
    • Manage Variables/Connection in Custom Widget

      SDP.getVariables() Fetches all the variables associated with the custom widget. Returns: Promise - Resolved with Success or Rejected with Failure. Syntax: SDP.getVariables().then(function(response) { console.log(response); }).catch(function(response) ...
    • Add Custom Widget

      Add Custom Widget to ServiceDesk Plus MSP Cloud Role Required: SDAdmin Go to Setup > Developer Space > Custom Widgets and click New Custom Widget. Follow the steps mentioned below to configure your own custom widget. Provide a name and description to ...