Wiki

    Contact support:

    Email: support@erply.com

    14 Jul, 2021
    Permalink:
    Also available in:EstonianFinnish

    4. Context Variables

    Erply back office predefines the following context variables.

    Generally, these variables can be assumed to be present, but it would be a good practice to guard for the variables being undefined:
     

    if (typeof page_lang !== 'undefined') { ... }
     

    variable name

    Possible values or example value

    Description

    page_lang 

    'eng'

    Current selected language for UI

    section 

    'invoices'

    Current section

    subsection

    ‘subsection_name’

    Current subsection

    customerCode 

    '5445'

    Customer code of current account

    apiSessionKey 

    'nVgS1b8a28bd66c30b8ba80af4febfea878a531bf677'

    Session key for current session. Can be used to make additional API calls.

    customerRegistryToken

    ‘eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1’

    Customer registry token

    userID 

    9

    ID of current userConfirm

    userName 

    ‘admin’

    name of current user

    employeeID 

    153

    Employee ID of current user

    employeeName 

    ‘John Doe’

    Employee name of current user

    userGroupID

    3

    Group ID of current user

    userGroupName 

    ‘administrators / management’

    Group name of current user

    isExistingRecord 

    true

    True if the the record is already saved. false if the record is being added.

    recordID

    5

    ID of the record being edited or viewed.

    formValuesAreOverridable

    true / false

    If you want to set default values on a form, you should first check this variable to be true. Otherwise you may end up overwriting fields already modified by user.

    formWasSaved

    true / false

    ‘true’ indicates that the last request resulted in form save. ‘false’ means that :

    • the form was just loaded

    • the form was submitted to recalculate some values

    • the form was submitted, but there were some errors

    newRecordCreated

    true / false

    ‘true’ indicates that the last save resulted in new record being created.

    existingRecordSaved

    true / false

    ‘true’ indicates that the last save resulted in existing record being updated.

    recordWasConfirmed

    true / false

    ‘true’ indicates that the last save resulted in record being confirmed. For example “Confirm” button was clicked on invoice form.

    isForm

    true / false

    Current view is a form

    isTable

    true / false

    Current view is a table

    Variables Containing Account Settings

    This is a list of variables that reflect settings for current Erply account. 

     

    variable name

    Example

    Description

    conf_dateformat 

    'd.m.Y'

     

    conf_date_monthdayformat 

    'd.m'

     

    thousandsSeparator 

    ' '

     

    decimalSymbol 

    ','

     

    priceDecimals

    4