Skip to content

Getting PM State

Oleg edited this page Aug 25, 2023 · 18 revisions

Some of available methods that could be used to learn the Siebel PM current state and what could be done:

  • canInvokeMethod(method) - returns true if the method specified by the input parameter could be executed.

  • getControls() - returns the object of applet's controls with their dynamic and static attributes.

  • getListColumns() - returns the object of list applet's list columns with their dynamic and static attributes (output similar to the output of getControls).

  • getControlsRecordSet(addRecordIndex) - the same as getRecordSet(addRecordIndex), but the objects' keys are controls' names (not fields' names as in the output of the getRecordSet method). The method converts the values and always returns the Id value.

  • getCurrentRecord(raw) - returns the currently selected record, if the raw input parameter is true, the raw recordset is returned.

  • getCurrentRecordModel(controls, methods) - returns the converted values and attributes of the controls for the current record, optionally it accepts the template object with the names of the controls to be returned. In addition, the controls object has the state property with the following possible values:

    • 0 - No records displayed
    • 1 - Record is being created
    • 2 - Record is being edited
    • 3 - Recordset is in query mode.
    • 4 - Record is displayed
    • 5 - Record is read-only

The methods input parameter also is optional, and contains the object where keys are methods names; if this parameter is passed, the getCurrentRecordModel sets the Boolean value for each key that indicates if the method could be invoked; otherwise all methods specified on the applet's controls will be returned. Send the empty literal object {} to avoid the calculations.

This methods modifies the input parameters.

  • getRecordSet(addRecordIndex) and getRawRecordSet(addRecordIndex) - return the current set of records displayed in the applet (returned value is copied and also returns the Id value). The getRawRecordSet method returns not formatted values, the getRecordSet returns formatted values. If the optional parameter addRecordIndex has truthy value, the output contains the zero-based index of the record (_indx). Note: getRecordSet returns one empty record in the query mode. getRawRecordSet still returns the recordset.

  • getSelection() - returns the zero-based index of the currently selected record; if no records, it returns -1. Please pay attention that the returned value doesn't correspond to the record index in the recordset fetched from the server.

  • getPaginationInfo() returns { start, end, total, hasMore, current } that could be used to display row counter information. hasMore returns the value of the IsNumRowsKnown PM property. To check if it makes sense to go to the next record set in the list applet, check canInvokeMethod('GotoNextSet').

  • getControlsRecordObjects

  • saveUserPref(userPrefName, userPrefValue) and getUserPref(userPrefName) The value is saved into the user's spf-file, this value is persisted between sessions.