Class: BusinessObject

Simplicite.Ajax.BusinessObject

new BusinessObject

Simplicité® business object.
Getting a new business object should use the Simplicite.Ajax.getBusinessObject() function instead of this constructor

Parameters:
Name Type Description
app Application Simplicite.Ajax instance
objName Object name
objInstName Object instance name, optional (defauts to ajax_<object name>)
autoRefreshMetaData deprecated
Source:
  • businessobject.js, line 41

Members

count

Current search result count.

Source:
  • businessobject.js, line 80

crosstabdata

Current cross table data.

Source:
  • businessobject.js, line 104

filters

Current search filters. Use filters["<field name>"] or filters.<field name> to access to the filter value

Source:
  • businessobject.js, line 74

item

Current item. Use item["<field name>"] or item.<field name> to access to the field value

Source:
  • businessobject.js, line 68

list

Current search result array of items.

Source:
  • businessobject.js, line 86

maxpage

Current search result max page index (for paginated searches).

Source:
  • businessobject.js, line 92

metadata

Current meta data.

  • name: object name
  • instance: object instance name
  • fields: fields definition array
  • TO BE COMPLETED...

Source:
  • businessobject.js, line 58

page

Current search result page index (for paginated searches).

Source:
  • businessobject.js, line 98

Methods

action

Calls an object action and loads action result.

Parameters:
Name Type Description
callback Callback function called when loading is completed (action result is passed to this function)
act Action name
params Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
Source:
  • businessobject.js, line 976

completion

Calls an object completion for specified field and loads action result.

Parameters:
Name Type Description
callback Callback function called when loading is completed (completion result is passed to this function)
field Field name
req Completion request
params Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
Source:
  • businessobject.js, line 1163

create

Creates and loads an item.

Parameters:
Name Type Description
callback Callback function called when loading is completed
item Item to be created (row ID field of the item must be set to Simplicite.Ajax.DEFAULT_ROW_ID), optional (if absent current item is used)
params Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
Source:
  • businessobject.js, line 756

crosstab

Loads cross table data for search filters.

Parameters:
Name Type Description
callback Callback function called when loading is completed
ctb Cross table name
filters Filters to be applied, optional (if absent, current filters are used)
params Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
Source:
  • businessobject.js, line 888

crosstabChartImage

Gets cross table data chart JPG image for search filters.

Parameters:
Name Type Description
callback Callback function called when loading is completed
ctb Cross table name
filters Filters to be applied, optional (if absent, current filters are used)
params Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
    Source:
    • businessobject.js, line 933

    del

    Deletes item. Current item is set to undefined.

    Parameters:
    Name Type Description
    callback Callback function called when loading is completed
    item Item to be deleted (in fact only row ID field is used), optional (if absent current item is used)
    params Optional parameters :
    • async Asynchronous call (use default if absent) ?
    • error Custom error handler (use default error handler if absent) ?
    Source:
    • businessobject.js, line 844

    get

    Selects and loads an item for designated row ID (if row ID is Simplicite.Ajax.DEFAULT_ROW_ID, a defaut item for creation is returned with all default values applied).

    Parameters:
    Name Type Description
    callback Callback function called when loading is completed
    rowId Row ID, mandatory
    params Optional parameters object may include:
    • context Init context (one of Simplicite.Ajax.CONTEXT_CREATE/UPDATE/DELETE/COPY constants)
    • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
    • inlineThumbs Inline image documents thumbnails (false if absent or undefined, can be a boolean or an array of image document fields to inline) ?
    • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
    • fields Array of field names to retreive (if absent or undefined, all fields are retreived)
    • async Asynchronous call (use default if absent or undefined) ?
    • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 273

      getCount

      Count items.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      filters Filters to be applied, optional (if absent, current filters are used)
      params Optional parameters
      Source:
      • businessobject.js, line 635

      getField

      Gets field from fields array in meta data (returns undefined if field is not found).

      Parameters:
      Name Type Description
      name Field name
      Source:
      • businessobject.js, line 206

      getFields

      Gets fields array from meta data (is undefined as long as meta data are not loaded using getMetaData).

      Source:
      • businessobject.js, line 189

      getFilters

      Loads current filters.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      params Optional parameters :
      • context Init context (normally Simplicite.Ajax.CONTEXT_SEARCH constant), optional
      • reset Reset filters, optional
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 477

      getFiltersForSearch

      Loads current filters for search (equivalent to a getFilters done with the search init context Simplicite.Ajax.CONTEXT_SEARCH).

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      params Optional parameters
      Source:
      • businessobject.js, line 518

      getForCopy

      Loads item for designated row ID for copy (equivalent to a get done with the copy init context Simplicite.Ajax.CONTEXT_COPY).

      Parameters:
      Name Type Description
      callback Callback function called when loading and context initialization is completed
      rowId Row ID, mandatory
      params Optional parameters (same as for get function)
      Source:
      • businessobject.js, line 378

      getForCreate

      Loads default item for creation (equivalent to a get done on default row ID with the create init context Simplicite.Ajax.CONTEXT_CREATE).

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      params Optional parameters (same as for get function)
      Source:
      • businessobject.js, line 338

      getForDelete

      Loads item for designated row ID for delete (equivalent to a get done with the delete init context Simplicite.Ajax.CONTEXT_DELETE).

      Parameters:
      Name Type Description
      callback Callback function called when loading and context initialization is completed
      rowId Row ID, mandatory
      params Optional parameters (same as for get function)
      Source:
      • businessobject.js, line 398

      getForUpdate

      Loads item for designated row ID for update (equivalent to a get done with the update init context Simplicite.Ajax.CONTEXT_UPDATE).

      Parameters:
      Name Type Description
      callback Callback function called when loading and context initialization is completed
      rowId Row ID, mandatory
      params Optional parameters (same as for get function)
      Source:
      • businessobject.js, line 358

      getHelp

      Gets help from meta data (is undefined as long as meta data are not loaded using getMetaData).

      Source:
      • businessobject.js, line 181

      getInstance

      Gets instance name from meta data.

      Source:
      • businessobject.js, line 165

      getLabel

      Gets label from meta data (is undefined as long as meta data are not loaded using getMetaData).

      Source:
      • businessobject.js, line 173

      Gets links array from meta data (is undefined as long as meta data are not loaded using getMetaData).

      Source:
      • businessobject.js, line 197

      getListValue

      Gets value from list for specified code (returns undefined if code is not in list).

      Parameters:
      Name Type Description
      list List metadata (typically from a field metadata)
      code Code
      Source:
      • businessobject.js, line 249

      getMetaData

      Loads meta data for specified context.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      params Optional parameters :
      • context Context (one of Simplicite.Ajax.CONTEXT_* constants)
      • contextParam Context parameter
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 129
      Example
      obj.getMetaData(function() {
      	alert("Meta data loaded for update of object " + this.getName());
      }, { context: app.CONTEXT_UPDATE });

      getName

      Gets name from meta data.

      Source:
      • businessobject.js, line 157

      getParameter

      Loads an object parameter.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed (parameter is passed to this function)
      name Parameter name
      params Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 1131

      getRowId

      Gets current item row Id value (returns undefined if not current item is loaded).

      Source:
      • businessobject.js, line 415

      getRowIdField

      Gets row Id field from meta data (returns undefined if row Id field name is undefined).

      Source:
      • businessobject.js, line 239

      getRowIdFieldName

      Gets row Id field name from meta data (is undefined as long as meta data are not loaded using getMetaData).

      Source:
      • businessobject.js, line 231

      getValueForCode

      Gets list of values field value from code (returns code if not found or not a list of value field)

      Parameters:
      Name Type Description
      field Field
      code Field code
      Source:
      • businessobject.js, line 219

      indexsearch

      Search from index and loads search result items.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      request Index search request string
      params Optional parameters :
      • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
      • inlineThumbs Inline image documents thumbnails (false if absent or undefined) ?
      • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 680

      isRowIdField

      Checks whether a field is the row ID field.

      Parameters:
      Name Type Description
      f Field meta data
      Source:
      • businessobject.js, line 1188

      isTimestampField

      Checks whether a field is a timestamp field.

      Parameters:
      Name Type Description
      f Field meta data
      Source:
      • businessobject.js, line 1197

      populate

      Populate item (e.g. after getForCreate and after having set foreign keys)

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      item Item to be populated, optional (if absent current item is used)
      params Optional parameters object may include:
      • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
      • inlineThumbs Inline image documents thumbnails (false if absent or undefined, can be a boolean or an array of image document fields to inline) ?
      • inlineObjs Inline object fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
      • async Asynchronous call (use default if absent or undefined) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 434

      print

      Calls an object publication and loads publication result.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed (publication result is passed to this function)
      prt Print template name
      params Optional parameters :
      • all Apply template to all items matching current filters (false by default, which means apply template only to current item) ?
      • mailing Apply template individually to all items matching current filter (false by default) ?
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 1023

      removeParameter

      Remove an object parameter.

      Parameters:
      Name Type Description
      callback Callback function called when completed
      name Parameter name
      params Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 1116

      save

      Saves (create or update) and loads an item.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      item Item to be saved, optional (if absent current item is used)
      params Optional parameters
      Source:
      • businessobject.js, line 736

      Search and loads search result items.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      filters Filters to be applied, optional (if absent, current filters are used)
      params Optional parameters :
      • context Init context (normally one of Simplicite.Ajax.CONTEXT_LIST/PANELLIST/REFSELECT/DATAMAPSELECT/EXPORT/CROSSTAB/GRAPH/PRINTTMPL constant), optional
      • page Page index to retreive (must be between 1 and maxpage), optional (if absent or set to 0 no pagination will be done, for pagination a first call must be done with pageIndex set to 1)
      • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
      • inlineThumbs Inline image documents thumbnails (false if absent or undefined) ?
      • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 541

      searchForList

      Search and loads search result items for list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_LIST).

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      filters Filters to be applied, optional (if absent, current filters are used)
      params Optional parameters
      Source:
      • businessobject.js, line 607

      searchForPanelList

      Search and loads search result items for panel list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_PANELLIST).

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      filters Filters to be applied, optional (if absent, current filters are used)
      params Optional parameters
      Source:
      • businessobject.js, line 621

      select

      Same as get function

      Source:
      • businessobject.js, line 330

      selectForCopy

      Same as getForCopy function

      Source:
      • businessobject.js, line 389

      selectForCreate

      Same as getForCreate function

      Source:
      • businessobject.js, line 349

      selectForDelete

      Same as getForDelete function

      Source:
      • businessobject.js, line 409

      selectForUpdate

      Same as getForUpdate function

      Source:
      • businessobject.js, line 369

      setListSize

      Sets the search size for pagination.

      Parameters:
      Name Type Description
      callback Callback function called when completed
      size Integer value
      params Optional parameters :
      Source:
      • businessobject.js, line 1101

      setParameter

      Sets (or remove) an object parameter and loads it back.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed (parameter is passed to this function)
      name Parameter name
      value Parameter value (if undefined parameter is unset)
      params Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 1072

      update

      Updates and loads an item.

      Parameters:
      Name Type Description
      callback Callback function called when loading is completed
      item Item to be updated, optional (if absent current item is used)
      params Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?
      Source:
      • businessobject.js, line 800