Skip to main content

Managing inventory lists on an external source

Bravura Identity maintains a list of inventory items in its database. You can also write a plugin to maintain the list on an external source.

To use an external inventory plugin:

  1. Click Manage the system > Inventory > Options .

  2. Type the name of the plugin in the EXT INVENTORY PLUGIN field.

  3. Click Update at the bottom of the page.

There is no shipped plugin in use with this plugin point. A sample, testinv.exe , is included in the distribution debug directory. This sample plugin uses an input file, testinv.txt , which is also in the debug directory.

Requirements

It is recommended that the plugin be written in PSLang, which has functions to automatically deal with the input and output protocol (KVGroups). The plugin must be placed in the \<instance>\plugin\ directory. See Writing plugins for general requirements.

Execution points

This plugin is run by the Manage the system (PSA) module, Help users (IDA) module, and View and update profile (IDR) module, and by the idwfm service.

Input

The plugin receives information from a change request or query.

The plugin performs the action specified by the input KVGroup. For example:

  • Count all available tokens in Calgary:

     "request" "" = { 
         "action" = "count" 
         "expr" "AND" = { 
           "LOCATION" = "CALGARY" 
           "STATE" = "N" 
           "TYPE" = "TOKEN" 
           "USER" = "" 
         } 
       }
  • Read all inventory items:

      "request" "" = { 
         "action" = "read" 
         "expr" "AND" = { 
         } 
       }
  • Read details for a specific inventory item:

     "request" "" = { 
         "action" = "read" 
         "expr" "AND" = { 
           "ID" = "A00001" 
           "TYPE" = "TOKEN" 
         } 
       }
  • Update an inventory item:

     "request" "" = { 
         "action" = "update" 
         "attributes" = "" = { 
           "BATCHID" = "20050823-131544-00" 
           "DESC"  = "some description" 
           "HOSTID" = "ACE" 
           "ID" = "A00001" 
           "ITEMID" = "4f00000000000000ff" 
           "LOCATION" = "CALGARY" 
           "NOTES" = "some notes" 
           "STATE" = "N" 
           "TYPE" = "TOKEN" 
           "USER" = "ABBEYBR" 
         } 
       }

    The "add" and "update" input KVGroup are similar.

The keys are defined as follows:

  • action Performs one of the following actions on the inventory item listed in the external source:

    • add Adds the item to list of available items

    • update Updates properties associated with the item

    • delete Removes the item from the list of available items

    • read Finds and displays information about all items with matching attributes

    • count Returns a count of items with matching attributes

  • expr Contains the expression for searching

    Search fields and their values are indicated by key-value pairs. The group name is one of:

    • AND the search matches on all key-value pairs

    • OR the search matches on any key-value pair

    Sub-expressions are formed by multiple, nested "expr" KVGroups.

  • attributes Properties to add or update on the external source.

    • BATCHID The request batch ID

    • DESC The item description

    • HOSTID The inventory target ID

    • ID The item identifier

    • ITEMID A unique identifier used internally by Bravura Identity

    • LOCATION Must be a valid location in Bravura Identity

    • NOTES Text entered in the Notes field

    • STATE The inventory item state

      Possible states are:

      • N Available

      • V Unavailable

      • R Reserved

      • U Undelivered

      • A Assigned

      • O Outstanding

    • USER The user to whom the item is assigned

Output

If the operation was successful, the plugin returns a result value of success

For an add/update/delete operation, only the result key is used. For example:

"response" "" = {
  "result" = "success"
 }

On failure, an error message is returned:

"response" "" = {
  "result" = "Could not contact database"
}

For a successful count action, the plugin returns something like:

"response" "" = {
    "count" = "4"
    "result" = "success"
    }

For a failed count action, the plugin returns an error message:

"response" "" = {
    "count" = ""
    "result" = "No such item"
}

Output for a successful read action includes a KVGroup for each item found. For example:

"response" = {
 "result" = "success"
  "object" "" = {
"BATCHID" = ""
    "DESC" = ""
 "HOSTID" = "ACE"
    "ID" = "A00011"
    "ITEMID" = ""
    "LOCATION" = "CALGARY"
    "NOTES" = ""
    "STATE" = "U"
    "TYPE" = "TOKEN"
    "USER" = "ADAMSBO"
     }
  "object" "" = {
    "BATCHID" = ""
    "DESC" = ""
    "HOSTID" = "NULL"
    "ID" = "A00021"
    "ITEMID" = ""
    "LOCATION" = "LA"
    "NOTES" = ""
    "STATE" = "R"
    "TYPE" = "TOKEN"
    "USER" = "ADAMSBO"
     }
}

Inventory items which do not have a valid type or location attribute are ignored by the plugin.