BusinessObject

simplicite~ BusinessObject

Business object.
ou should never instanciate this class directly but rather call getBusinessObject to get a cached instance.

Constructor

new BusinessObject(ses, name, instanceopt)

Description:
  • Constructor
Source:
Parameters:
Name Type Attributes Description
ses Session Session
name string Business object name
instance string <optional>
Business object instance name, defaults to js_<object name>

Methods

action(action, rowIdopt, optsopt) → {promise.<(string|object)>}

Description:
  • Invoke a custom action
Source:
Parameters:
Name Type Attributes Description
action string Action name
rowId string <optional>
Row ID
opts object <optional>
Options
Properties
Name Type Attributes Description
parameters function <optional>
Optional action parameters as key/value pairs
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
A promise to the action result
Type
promise.<(string|object)>

create(itemopt, optsopt) → {promise.<object>}

Description:
  • Create (create or update)
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the created record (also available as the item member)
Type
promise.<object>

crosstab(ctb, optsopt) → {promise.<object>}

Description:
  • Build a pivot table
Source:
Parameters:
Name Type Attributes Description
ctb string Pivot table name
opts object <optional>
Options
Properties
Name Type Attributes Description
cubes boolean <optional>
Data as cubes?
filters object <optional>
Filters, by default current filters are used
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
A promise to the pivot table data (also avialable as the crosstabdata member)
Type
promise.<object>

del(itemopt, optsopt) → {promise.<object>}

Description:
  • Delete
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise (the item member is emptied)
Type
promise.<object>

get(rowIdopt, optsopt) → {promise.<object>}

Description:
  • Get
Source:
Parameters:
Name Type Attributes Description
rowId string <optional>
Row ID (defaults to current item's row ID)
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Refresh meta data?
fields Array.<string> <optional>
List of field names to return, all fields are returned by default
treeview string <optional>
Return the named tree view structure
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the record (also available as the item member)
Type
promise.<object>

getCount(filtersopt, optsopt) → {promise.<object>}

Description:
  • Get count
Source:
Parameters:
Name Type Attributes Description
filters object <optional>
Filters (defaults to current filters)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the count
Type
promise.<object>

getField(fieldName) → {object}

Description:
  • Get a field definition
Source:
Parameters:
Name Type Description
fieldName string Field name
Returns:
Field definition
Type
object

getFieldDataURL(field, itemopt) → {string}

Description:
  • Get the data URL of an inlined document/image field for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
Returns:
Document/image field data URL (or nothing if the field is not of document/image type or if it is not inlined or if it is empty)
Type
string

getFieldDocument(field, itemopt) → {string|Doc}

Description:
  • Get the field's value as document/image for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
Returns:
Document/image (or nothing if the field is not of document/image type or if it is empty)
Type
string | Doc

getFieldDocumentURL(field, itemopt, thumbnailopt) → {string}

Description:
  • Get the URL of a document/image field for item (or current item)
Source:
Parameters:
Name Type Attributes Default Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
thumbnail boolean <optional>
false Thumbnail?
Returns:
Document/image field URL (or nothing if the field is not of document/image type or if it is empty)
Type
string

getFieldLabel(field) → {string}

Description:
  • Get field label
Source:
Parameters:
Name Type Description
field string | object Field name or definition
Returns:
Field label
Type
string

getFieldLinkedList(field, linkedField, codeopt, optsopt) → {promise.<object>}

Description:
  • Get the linked list for a list of values field and its specified value(s)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
linkedField string | object Linked field name or definition
code string | boolean <optional>
List of values code(s) (if multiple codes use ; as separator), defaults to current field value if empty, means "all" if true
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the populated record (also available as the item member)
Type
promise.<object>

getFieldListColors(field, itemopt) → {string}

Description:
  • Get the list colors of a list of values field for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
Returns:
List color and bgcolor
Type
string

getFieldListValue(field, itemopt) → {string}

Description:
  • Get the list value of a list of values field for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
Returns:
List value
Type
string

getFieldType(field) → {string}

Description:
  • Get field type
Source:
Parameters:
Name Type Description
field string | object Field name or definition
Returns:
Type (one of constants.TYPE_*)
Type
string

getFieldValue(field, itemopt) → {string|Doc}

Description:
  • Get value of field for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
item object <optional>
Item (defaults to current item)
Returns:
Value
Type
string | Doc

getFields() → {array}

Description:
  • Get all fields definitions
Source:
Returns:
Array of field definitions
Type
array

getFilters(optsopt) → {promise.<object>}

Description:
  • Get current filters
Source:
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Description
context number <optional>
Context
reset boolean <optional>
Reset filters?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the object's filters (also available as the filters member)
Type
promise.<object>

getForCopy(rowIdopt, optsopt) → {promise.<object>}

Description:
  • Get for copy
Source:
Parameters:
Name Type Attributes Description
rowId string <optional>
Row ID to copy (defaults to current item's row ID)
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Refresh meta data?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the record to create (also available as the item member)
Type
promise.<object>

getForCreate(optsopt) → {promise.<object>}

Description:
  • Get for create
Source:
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Refresh meta data?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the record to create (also available as the item member)
Type
promise.<object>

getForDelete(rowIdopt, optsopt) → {promise.<object>}

Description:
  • Get for delete
Source:
Parameters:
Name Type Attributes Description
rowId string <optional>
Row ID (defaults to current item's row ID)
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Refresh meta data?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the record to delete (also available as the item member)
Type
promise.<object>

getForUpdate(rowIdopt, optsopt) → {promise.<object>}

Description:
  • Get for update
Source:
Parameters:
Name Type Attributes Description
rowId string <optional>
Row ID (defaults to current item's row ID)
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Refresh meta data?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the record to update (also available as the item member)
Type
promise.<object>

getHelp() → {string}

Description:
  • Get help
Source:
Returns:
Help
Type
string

getInstance() → {string}

Description:
  • Get instance name
Source:
Returns:
Instance name
Type
string

getLabel() → {string}

Description:
  • Get display label
Source:
Returns:
Display label
Type
string
Description:
  • Get links
Source:
Returns:
Array of links
Type
array

getListColors(list, code) → {any}

Description:
  • Get list item colors (color and background color) for code
Source:
Parameters:
Name Type Description
list array List of values
code string Code
Returns:
Colors
Type
any

getListValue(list, code) → {string}

Description:
  • Get list item value for code
Source:
Parameters:
Name Type Description
list array List of values
code string Code
Returns:
Value
Type
string

getMetaData(optsopt) → {promise.<BusinessObjectMetadata>}

Description:
  • Get meta data
Source:
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Description
context number <optional>
Context
contextParam string <optional>
Context parameter
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
A promise to the object's meta data (also available as the metadata member)
Type
promise.<BusinessObjectMetadata>

getMetadata()

Description:
  • Get meta data (alias to getMetaData)
Source:

getName() → {string}

Description:
  • Get name
Source:
Returns:
Name
Type
string

getParameter(param, optsopt) → {promise.<object>}

Description:
  • Get an object parameter
Source:
Parameters:
Name Type Attributes Description
param string Parameter name
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the parameter value
Type
promise.<object>

getPath(action, optsopt)

Description:
  • Get path
Source:
Parameters:
Name Type Attributes Description
action string Action
opts object <optional>
Options
Properties
Name Type Attributes Description
businessCase string <optional>
Business case label

getResourceURL(code, typeopt) → {string}

Description:
  • Get an object resource URL
Source:
Parameters:
Name Type Attributes Default Description
code string Resource code
type string <optional>
IMG Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)
Returns:
Object resource URL
Type
string

getRowId(itemopt) → {string}

Description:
  • Get specified or current item's row ID value
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
Returns:
Item's row ID value
Type
string

getRowIdField() → {object}

Description:
  • Get row ID field definition
Source:
Returns:
Row ID field definition
Type
object

getRowIdFieldName() → {string}

Description:
  • Get row ID field name
Source:
Returns:
Row ID field name
Type
string

isRowIdField(field) → {boolean}

Description:
  • Is the field the row ID field?
Source:
Parameters:
Name Type Description
field object Field definition
Returns:
True if the field is the row ID field
Type
boolean

isTimestampField(field) → {boolean}

Description:
  • Is the field a timestamp field?
Source:
Parameters:
Name Type Description
field object Field definition
Returns:
True if the field is a timestamp field
Type
boolean

placemap(pcm, filtersopt, optsopt) → {promise.<any>}

Description:
  • Get place map data
Source:
Parameters:
Name Type Attributes Description
pcm string Place map name
filters string <optional>
Filters
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
A promise to the place map data
Type
promise.<any>

populate(itemopt, optsopt) → {promise.<object>}

Description:
  • Populate
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the populated record (also available as the item member)
Type
promise.<object>

print(prt, rowIdopt, optsopt) → {promise.<Doc>}

Description:
  • Build a custom publication
Source:
Parameters:
Name Type Attributes Description
prt string Publication name
rowId string <optional>
Row ID
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
A promise to the document of the publication
Type
promise.<Doc>

save(itemopt, optsopt) → {promise.<object>}

Description:
  • Save (create or update depending on item row ID value)
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the saved record (also available as the item member)
Type
promise.<object>
Description:
  • Search
Source:
Parameters:
Name Type Attributes Description
filters object <optional>
Filters (defaults to current filters)
opts object <optional>
Options
Properties
Name Type Attributes Default Description
page number <optional>
Page number, a non paginated list is returned if not set
metadata boolean <optional>
false Refresh meta data?
visible boolean <optional>
Return only visible fields?
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to a list of records (also available as the list member)
Type
promise.<array>

setFieldValue(field, value, itemopt)

Description:
  • Set value of field for item (or current item)
Source:
Parameters:
Name Type Attributes Description
field string | object Field name or definition
value string | object Value
item object <optional>
Item (defaults to current item)

setParameter(param, value, optsopt) → {promise.<object>}

Description:
  • Set an object parameter
Source:
Parameters:
Name Type Attributes Description
param string Parameter name
value string Parameter value
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise
Type
promise.<object>

update(itemopt, optsopt) → {promise.<object>}

Description:
  • Update
Source:
Parameters:
Name Type Attributes Description
item object <optional>
Item (defaults to current item)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
businessCase string <optional>
Business case label
Returns:
Promise to the updated record (also available as the item member)
Type
promise.<object>