Add Custom Action

Created by

Paul Ojennus, Whitworth University

With special thanks to Nick Budak who originally developed the code.

Code Repository

https://github.com/alliance-pcsg/primo-explore-custom-actions

Description

Add custom action such as report a problem, send text message, or view PNX to the “Send to” ribbon in Primo.

Custom action in a Primo record for Send SMS

System Components

PBO, Package Manager

Skill Set Requirements

PBO, Javascript

Implementation Steps

  1. In the PBO make sure you have the “Inherit Central Package” box checked.
  2. In your local package, in the custom.js file, include the module ‘customActions’ in your app definition, for example:

    var app = angular.module('viewCustom', ['customActions']);

    If you are using other angular modules, your app definition will include those also.
  3. In your local package, in the custom.js file, include the following block of code from this file.
  4. You can customize the fields:
    • name: this is internal to the code, it just needs to be unique
    • label: this is the text that will appear in the Send To ribbon
    • index: any integer, 0 is on the far left
    • icon: the name of the icon from https://material.io/icons/
    • icon-set: the name of the icon set
    • link: the URL you are opening; you can insert data from the pnx as in {pnx.search.recordid[0]}
    • target: this set the action to open in a new tab/window is set to “_blank” or in the same window (useful for mailto: links) if set to “_self”. If no value is set, this defaults to “_blank”
  5. You can add multiple custom actions: repeat the <custom action> element in the template and assign a unique name to each action.
  6. Zip and upload your local package in the PBO
  7. Deploy your view

Related Customizations