Front End API Reference

Classes

PermissionManager

Provides access to user defined permissions for a component.

hasPermission(code)

Returns true if current user has access to specified permission code.

Parameters:code – (string) permission code
Return type:boolean

Modules

Environment (Shr.Env)

The environment module provides access to a set of internal platform functions.

Shr.Env.log(variable)

Displays information about a variable in a readable way.

Parameters:variable – (mixed) variable to format
Return type:string
Shr.Env.getBaseUrl()

Returns system base URL (e.g. https://app.subscribe-hr.com).

Return type:string
Shr.Env.getAppUrl()

Returns application URL (e.g. https://app.subscribe-hr.com/cb/app).

Return type:string
Shr.Env.getModuleUrl()

Returns current module URL (e.g. https://app.subscribe-hr.com/cb/app/hr).

Return type:string
Shr.Env.getComponentApiUrl(id, function, options)

Creates request URL for component API function.

Parameters:
  • id – (string) component id
  • function – (string) function name
  • options – (object) URL parameters
Return type:

string

Shr.Env.getComponentPermissions(id)

Returns component permission manager.

Parameters:id – (string) component id
Return type:PermissionManager

Request (Shr.Request)

Request module provides access to information about the client request. This information can be accessed via the following methods.

Shr.Request.getParameter(name)

Extracts client parameter from POST or GET request.

Parameters:name – (string) parameter name
Return type:mixed

UI / Template (Shr.UI)

UI module provides functions to help generate user interface.

Shr.UI.createField(options)

Generates form field in the template.

Parameters:options – (arguments) series of arguments depending on the type of field being generated
Return type:string

Util (Shr.Util.Base64)

Module to encode and decode base64 strings.

Shr.Util.Base64.encode(content)

Encodes string in base64 format.

Parameters:content – (string) string to encode
Return type:string
Shr.Util.Base64.decode(content)

Decodes a base64 string.

Parameters:content – (string) string to decode
Return type:string

Util (Shr.Util.File)

Module to work with files Subscribe-HR virtual storage.

Shr.Util.File.create(name, content, isTemp)

Creates file in virtual storage.

Parameters:
  • name – (string) file name
  • content – (string) file content
  • isTemp – (boolean) is file temporary (temporary files are removed after 24 hours if they are not attached to records)
Return type:

string - file id

Shr.Util.File.update(id, name, content)

Update file.

Parameters:
  • name – (string) file id
  • name – (string) file name
  • content – (string) file content
Return type:

string - file id