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)

Source:
Constructor
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)>}

Source:
Invoke a custom action
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
Returns:
A promise to the action result
Type
promise.<(string|object)>

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

Source:
Create (create or update)
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
Returns:
Promise to the created record (also available as the item member)
Type
promise.<object>

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

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

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

Source:
Delete
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
Returns:
Promise (the item member is emptied)
Type
promise.<object>

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

Source:
Get
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
Returns:
Promise to the record (also available as the item member)
Type
promise.<object>

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

Source:
Get count
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
Returns:
Promise to the count
Type
promise.<object>

getField(fieldName) → {object}

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

getFieldDataURL(field, itemopt) → {string}

Source:
Get the data URL of an inlined document/image field for item (or current item)
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}

Source:
Get the field's value as document/image for item (or current item)
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}

Source:
Get the URL of a document/image field for item (or current item)
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}

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

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

Source:
Get the linked list for a list of values field and its specified value(s)
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
Returns:
Promise to the populated record (also available as the item member)
Type
promise.<object>

getFieldListValue(field, itemopt) → {string}

Source:
Get the list value of a list of values field for item (or current item)
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

getFields() → {array}

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

getFieldType(field) → {string}

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

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

Source:
Get value of field for item (or current item)
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

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

Source:
Get current filters
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
Returns:
Promise to the object's filters (also available as the filters member)
Type
promise.<object>

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

Source:
Get for copy
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
Returns:
Promise to the record to create (also available as the item member)
Type
promise.<object>

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

Source:
Get for create
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
Returns:
Promise to the record to create (also available as the item member)
Type
promise.<object>

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

Source:
Get for delete
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
Returns:
Promise to the record to delete (also available as the item member)
Type
promise.<object>

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

Source:
Get for update
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
Returns:
Promise to the record to update (also available as the item member)
Type
promise.<object>

getHelp() → {string}

Source:
Get help
Returns:
Help
Type
string

getInstance() → {string}

Source:
Get instance name
Returns:
Instance name
Type
string

getLabel() → {string}

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

getListValue(list, code) → {string}

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

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

Source:
Get meta data
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
Returns:
A promise to the object'ts meta data (also available as the metadata member)
Type
promise.<BusinessObjectMetadata>

getMetadata()

Source:
Get meta data (alias to getMetaData)

getName() → {string}

Source:
Get name
Returns:
Name
Type
string

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

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

getResourceURL(code, typeopt) → {string}

Source:
Get an object resource URL
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}

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

getRowIdField() → {object}

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

getRowIdFieldName() → {string}

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

isRowIdField(field) → {boolean}

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

isTimestampField(field) → {boolean}

Source:
Is the field a timestamp field?
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>}

Source:
Get placem map data
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
Returns:
A promise to the place map data
Type
promise.<any>

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

Source:
Populate
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
Returns:
Promise to the populated record (also available as the item member)
Type
promise.<object>

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

Source:
Build a custom publication
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
Returns:
A promise to the document of the publication
Type
promise.<Doc>

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

Source:
Save (create or update depending on item row ID value)
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
Returns:
Promise to the saved record (also available as the item member)
Type
promise.<object>
Source:
Search
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
Returns:
Promise to a list of records (also available as the list member)
Type
promise.<array>

setFieldValue(field, value, itemopt)

Source:
Set value of field for item (or current item)
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>}

Source:
Set an object parameter
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
Returns:
Promise
Type
promise.<object>

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

Source:
Update
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
Returns:
Promise to the updated record (also available as the item member)
Type
promise.<object>