onClickActions

Set of actions that can be done in the onClick property.

Interface

interface onClickActions {
  type: Actions;
}

Actions

enum Actions {
  OpenUrl = "OpenUrl",
  OpenUrlNewTab = "OpenUrlNewTab",
  OpenForm = "OpenForm",
  FollowUser = "FollowUser",
  Follow = "Follow",
  Favorite = "Favorite",
  Translate = "Translate",
  CopyLink = "CopyLink",
  Feedback = "Feedback",
  Followers = "Followers",
  Download = "Download",
  ClickElements = "ClickElements",
}

Types

OpenUrl

Open a URL.

  • Params:
interface OpenUrl {
  url: string; // url to open
  setView?: boolean; // if "true", the "setView" service will be called to account for the view of the url
}
  • Example:
"onClick": {
   "type": "OpenUrl",
   "url": "https://www.google.es/"
}

OpenUrlNewTab

Open a url in a new tab.

  • Params:
interface OpenUrlNewTab {
  url: string; // url to open
  setView?: boolean; // if "true", the "setView" service will be called to account for the view of the url
}
  • Example:
"onClick": {
   "type": "OpenUrlNewTab",
   "url": "https://www.google.es/",
   "setView": true
}

OpenForm

Open an existing form within the same Addon.

  • Params:
interface OpenForm {
  formId: string; //  create | edit | display | <additional form id>
  disableUpdateDataOnDismissForm?: boolean; // by default, when closing a panel with a form it makes a call to the backend to update the data in the cards, if we want to avoid this behavior we must set the property disableUpdateDataOnDismissForm to true
}
  • Example:
"onClick": {
   "type": "OpenForm",
   "formId": "create"
}
"onClick": {
   "type": "OpenForm",
   "formId": "edit"
}
"onClick": {
   "type": "OpenForm",
   "formId": "display",
   "disableUpdateDataOnDismissForm": true
}
"onClick": {
   "type": "OpenForm",
   "formId": "c9304f6b-41d0-42d6-b309-561cf775ffa8",
}

FollowUser

Follow the indicated user account.

  • Params:
interface FollowUser {
  uniqueId: string; // user uniqueId
  account: string; // user account
  dataPropToUpdate?: string; // the property path of the data that we want to update with the result returned by the action.
}
  • Example:
"onClick": {
   "type": "FollowUser",
   "uniqueId": "o93836b-41d0-89hg-b309-423hhhjgu87",
   "account": "syntphony@everistogo.onmicrosoft.com",
   "dataPropToUpdate": "user.follow"
}

Follow

Follow the content that is clicked.

  • Params:
interface Follow {
  uniqueId: string; // content uniqueId
  dataPropToUpdate?: string; // the property path of the data that we want to update with the result returned by the action.
}
  • Example:
"onClick": {
   "type": "Follow",
   "uniqueId": "c9304f6b-41d0-42d6-b309-561cf775ffa8",
   "dataPropToUpdate": "base.socials.follow.status"
}

Favorite

Add to favorites the content that is clicked.

  • Params:
interface Favorite {
  uniqueId: string; // content uniqueId
  dataPropToUpdate?: string; // the property path of the data that we want to update with the result returned by the action.
}
  • Example:
"onClick": {
   "type": "Favorite",
   "uniqueId": "c9304f6b-41d0-42d6-b309-561cf775ffa8",
   "dataPropToUpdate": "base.socials.favorite.status"
}

Translate

Open a panel with multilanguage options.

  • Params:
interface Translate {
  formId?: string; // create | edit | display | <additional form id>
}
  • Example:
"onClick": {
   "type": "Translate"
}
"onClick": {
   "type": "Translate",
   "formId": "c9304f6b-41d0-42d6-b309-561cf775ffa8"
}

Copy the indicated value or the content link to the clipboard.

  • Params:
interface CopyLink {
  value?: string; // value that will be copied to the clipboard
}
  • Example:
"onClick": {
   "type": "CopyLink"
}
"onClick": {
   "type": "CopyLink",
   "value": "https://www.google.es"
}

Feedback

Open the feedback panel.

  • Example:
"onClick": {
   "type": "Feedback"
}

Followers

Open followers panel.

  • Example:
"onClick": {
   "type": "Followers"
}

Download

Download a document.

  • Params:
interface Download {
  downloadUrl: string; // downloadUrl of document
  fileName:string; // file name
  • Example:
"onClick": {
   "type": "Download",
   "downloadUrl": "{base.urls.downloadUrl}",
   "fileName": "{base.fileName}"
}

ClickElements

Click on the indicated elements by their selectors.

  • Params:
interface ClickElements {
  selectors: string[]; // array of selectors to click
}
  • Example:
"onClick": {
   "type": "ClickElements",
   "selectors": ["[data-automationid=\"navEditLink\"]",".ms-HorizontalNavItem-alignSelf button"]
}