SDP.getCurrentInstance();
Fetches the details of the instance where the custom widget is loaded.
Returns:
Object – Returns instance details object.
Syntax:
- var instanceDetails = SDP.getCurrentInstance();
Sample Response:
- {
- appdisplayname: "IT Desk"
- appid: "15459854"
- appname: "itdesk"
- }
SDP.getCurrentUserId();
Fetches the logged-in user ID.
Returns:
String – Returns userId as a string.
Syntax:
- var userId = SDP.getCurrentUserId();
Sample Response:
SDP.getCurrentUserType();
Fetches the logged-in user type (requester/technician). Note that this function does not fetch roles.
Returns:
String – Returns user type as a string.
Syntax:
- var userType = SDP.getCurrentUserType();
Sample Response:
SDP.getCurrentUserName();
Fetches the logged-in user name.
Returns:
String – Returns user name as a string.
Syntax:
- var userName = SDP.getCurrentUserName();
Sample Response:
SDP.getCurrentUserEmail();
Description: Fetches the email address of the current user.
Returns:
String – Returns user email as a string.
Syntax:
- var userEmail = SDP.getCurrentUserEmail();
Sample Response:
- "johndoe@somecompany.com"
Description: Fetches the current widget info.
Returns:
Object – Returns the widget info object.
Syntax:
- var widgetInfo = SDP.getWidgetInfo();
Sample Response:
- {
- "id": "120747000002587069",
- "name": "Custom Widget",
- "description": "",
- "custom_widget": {
- "id": "120747000002587067"
- }
- }
Description: Fetches the widget meta passed to the widget.
Returns:
Object – Returns the widget meta object.
Syntax:
- var widgetMeta = SDP.getWidgetMeta();
Sample Response:
- {
- "module": "header",
- "instance": {
- "appid": "709641411",
- "appname": "widgetdev",
- "appdisplayname": "Widget Development"
- },
- "personalization": {
- "time_zone": "Asia/Kolkata",
- "time_format": "MMM d, yyyy hh:mm a",
- "date_format": "MMM d, yyyy"
- },
- "userLanguage": "en",
- "userLocale": "en_US",
- "userType": "Technician",
- "userId": "120747000000232217",
- "userName": "Widget Development",
- "userEmail": "widget_dev@sdpdev.onmicrosoft.com",
- "isSDAdmin": true,
- "widget": {
- "id": "120747000002587069",
- "name": "Custom Widget",
- "description": "",
- "custom_widget": {
- "id": "120747000002587067"
- }
- }
- }
Fetches the location of the current widget.
Returns:
String – Returns the widget location.
Syntax:
- var location = SDP.getWidgetInvokedLocation();
Sample Response:
SDP.getDataPassedByparent();
Fetches the data passed from the parent widget to the child widget by the user when the child widget is opened as a pop-up. The data fetched will be passed only after the SDP.openWidget(); is called.
Returns:
Object – Returns the data object passed by parent widget.
Syntax:
- var data = SDP.getDataPassedByparent();
Sample:
- {
- mode: "new_user"
- }
SDP.getParentLocation() ;
Fetches the location of the parent widget that has called the child widget.
Returns:
String – Returns the parent widget location.
Syntax:
- var parentLocation = SDP.getParentLocation();
Sample Response:
Fetches the details of the parent widget which has called the child widget.
Returns:
Object – Returns the parent widget info object.
Syntax:
- var parentInfo = SDP.getParentWidgetInfo();
Sample Response:
- {
- "id":"100000000000032273",
- "name":"Sample Widget",
- "description":"Sample Widget",
- "custom_widget":{
- "id":"100000000000032271"
- }
- }