UI Methods

This method helps to trigger any of the desk UI actions from the widget.

Available UI actions  are:

 

ROUTE_TO

This API allows you to navigate to the add forms page of different static modules such as ticket, contact, account and more that are available in the desk portal and to specific sub-tabs in the ticket details view page. It also helps you open another widget of the extension. This API accepts two types of arguments: string and JSON object.

This API is supported for the given locations: desk.topband, desk.ticket.detail.subtab, desk.ticket.detail.lefttab, desk.bottomband, and desk.extension.telephony.

Using this API you can route to: 

 

Route to Add Form Pages

These properties allow you to navigate to the add forms page of multiple modules like ticket, article, contact, account, call, task, event, topic, and solution that are available in add (+) drop-down list of desk portal.

In the widget file, these properties can be given in the below format:

  • ticket.addForm
  • contact.addForm
  • account.addForm
  • task.addForm
  • topic.addForm
  • event.addForm
  • solution.addForm
 

Route to Ticket Detail View Sub-Tabs 

These properties allow you to navigate within the sub-tabs available in ticket detail view page of the desk portal.

In the widget file, these properties can be given in the below format:

  • ticket.history
  • ticket.task
  • ticket.attachments
  • ticket.timeEntry
  • ticket.resolution
  • ticket.threads
  • ticket.conversation
  • ticket.approval
  • ticket.suggestedArticles
  • ticket.properties
  • ticket.timeline

Sample Request

Copied//Route to add form page

ZOHODESK.invoke("ROUTE_TO", "ticket.addForm");

//Route to History Subtab

ZOHODESK.invoke("ROUTE_TO", "ticket.history");
 

Route to Add/Edit/Detail View Pages (using entity Id)

You have the option to navigate the page by the record id, whose properties are given below:

ParamDescription
entityName of the entity. Values allowed are: ticket, contact, account, call, task, and event.
idID of the record to navigate to. This parameter is not needed for the add action
pagePage to open. Values allowed are add and edit. Default value is dv (detail view).

 

Sample Request

Copied//Route to ticket edit page with ticket id
ZOHODESK.invoke("ROUTE_TO" , {
		entity : "ticket",
		id : "31138000012704001", //id of record to navigate
		page : "edit" //page to open
	})
 

Route to Widgets

You can open/navigate to the extension widget from another widget.

ParamDescription
entityName of the entity. The value is extension.
locationThe location name of the widget to be opened, as specified in plugin-manifest.json.
nameThe unique name of the widget to be opened, as specified in plugin-manifest.json.

 

Sample Request

CopiedZOHODESK.invoke("ROUTE_TO" , {
		entity : "extension",
		location : "desk.ticket.detail.subtab", //invoke location
		name : "subtab-widget" //name of the widget 
	})
 

SHOW

This API shows/opens the widget programmatically from the extension source. It's specifically used for chat/call based extensions. For example, if any message/call is received, then the widget can be opened automatically by the developer.

It can be supported in desk.ticket.detail.rightpanel, desk.ticket.detail.moreaction, desk.ticket.thread.moreaction, desk.bottomband, and desk.extension.telephony locations.

 

Sample Request

CopiedZOHODESK.invoke("SHOW");
 

HIDE 

This API hides/closes the widget programmatically from the extension source. For example, it will be useful when some background operations are done or when a widget is closed based on some other action.

It will work for the following locations : desk.ticket.detail.rightpanel, desk.ticket.detail.moreaction, desk.ticket.thread.moreaction, desk.bottomband, and desk.extension.telephony.

Sample Request

CopiedZOHODESK.invoke("HIDE");
 

MINIMIZE 

This api allows you to minimize the widget. It works only in desk.bottomband and desk.extension.telephony locations.

Sample Request

CopiedZOHODESK.invoke("MINIMIZE");
 

MAXIMIZE

This api allows you to maximize the widget. It works only in desk.bottomband and desk.extension.telephony locations.

Sample Request

CopiedZOHODESK.invoke("MAXIMIZE");
 

RESIZE

This API allows you to resize the height and width of the widget.

Note:
For all Right Panel widgets, the height gets resized according to the content and it has a default max height (545 px).
For desk.extension.telephony location both height and width gets resized.
For modal box widget, the width and height get resized to the specified width and height.
Width and Height values can only be denoted in px (pixels), % (percentage), vh (viewport height), and vw (viewport width) formats.

Sample Request

Copied//without width and height specified

ZOHODESK.invoke("RESIZE");


//with width and height specified

ZOHODESK.invoke("RESIZE", {width: "40%", height: "50%"});

MODAL_CLOSE

This API closes the modal widget programmatically from the extension source.

Sample Request

CopiedZOHODESK.invoke("MODAL_CLOSE");


Note: Always enter the API names in capital letters with an underscore if they contain multiple words. Entering the api names in small letters or with any misspelling will give you an "Invalid Path" error message.