User Defined Defaults


File-> Customisation Configuration -> User Defined Defaults



The idea of this feature is to allow you to defined default field values. This can be useful when setting up new records be they Orders, Customers, Supplier, Items etc..  These User Defined Defaults can occur when a new record is 'Inserted' into the database or when an existing record is Updated.


This frees up the user to simply focus on specific fields when entering a new record or order etc.. thereby leaving Ostendo to manage the default field values defined for the organisation.


This feature avoids the need for defining Required Fields, Custom Triggers and Screen Data Scripts in order to force a field value. 


There are four methods that control when a Default Field Value can be used:


    1. On Insert when Blank
    2. On Insert and Update when Blank
    3. On Insert Always
    4. On Insert and Update Always



Note:

    • When setting a default field value that requires validation, ensure the field value you define is correct in every way eg: Case Sensitivity, spelling etc..


    • When defining a 'From Clause' and 'Conditional Clause' that relate to more than one table, you must prefix each field name with the Table Name 

eg: JobHeader.SalesPerson (aliases may be used to abbreviate table names 'OTHER'  than Primary Table Name)


    • These rules are run whenever a record is either inserted or updated in the database. This includes records being entered or amended via external sources eg: Data Imports or API


    • Ostendo runs User Defined Defaults,Validations and Action in the following sequence
      1. User Defined Defaults
      2. User Defined Validations
      3. User Defined Actions


Hint:

When defining a User Defined Default with 'From and Conditional' Clauses it is suggested you first test your syntax in the Data Spreadsheet (General -> Data Spreadsheet) feature of Ostendo prior to implementing the default values rule.


eg: 

Select Jobheader.SalesPerson from JOBHEADER,CUSTOMERMASTER where JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER and CUSTOMERMASTER.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 


Fields:

    • Table Name: Drop Down and select the Table Name of the Field you wish to define the Default Value against
    • Field Name: Drop Down and select the Field Name of the Field you wish to define the Default Value against
    • Default When:
      • On Insert When Blank: This rule will run only when the Field Name (defined above) is left Blank on the screen when adding a new record
      • On Insert and Update When Blank: This rule will run only when the Field Name (defined above) is left Blank on the screen when either adding or updating a record
      • On Insert Always: This rule will always run when the Field Name (defined above) is either blank or has an entry in it only when adding a new record
      • On Insert and Update Always: This rule will always run when the Field Name (defined above) is either blank or has an entry in it when either adding or updating a record


    • Default Field Value: This maybe a Literal value (ie: Free-form text or a Field Value).
      • NB: When this is a Literal Value, care must be taken if this Value is a validated entry. eg: Jane Steel, not jane Steel
      • If a Field Value is to be used, simply enclose the field with square brackets eg: [CUSTOMERMASTER.SALESPERSON]
      • A Domain Value does not need to be enclosed in single quotes.
    • From Clause: Specify the Table Name(s) to be used in the Conditional Clause eg: JOBHEADER,CUSTOMERMASTER
    • Conditional Clause: Specify the conditioning syntax from the 'where' clause in the SQL. eg: JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER and CUSTOMERMASTER.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 
    • Rule Status: These options allow you to control the Status of this rule.
      • Restricted to User: (Default) Select this only to allow a specific user to test this Default before it is released to all Users. (This is used in conjunction with the Test User Option)
      • Active For All Users: This Rule is now available to all users in this database and is effectively 'Live'
      • Not Active: This Rule is no longer Active, therefore despite it remaining in the Defaults, it is never triggered. Use this to temporarily turn off this rule.
    • Restricted User: (Must be specified if Rule Status is set to 'Restricted User') Specify a User that this rule will only be Active for. This allows you to test this rule before committing it to the 'Live' environment.




Examples:

On Insert when Blank:


Suppose we want to default the field SALESPERSON value to "Jane Steel" if that field is left blank when a new Customer is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

CUSTOMERMASTER

SALESPERSON

On Insert when Blank

Jane Steel



Active For All Users




Suppose we want to default the field ADDITIONALFIELD_1 value to "12345" if that field is left blank when a new Item is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

ITEMMASTER

ADDITIONALFIELD_1

On Insert when Blank

12345



Active For All Users




Suppose we want to default the field ABCCLASS value to "A" if that field is initially blank and if the Analysis Group is set to 'Materials' when a new Item is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

ITEMMASTER

ABCCLASS

On Insert When Blank

'A'

ITEMMASTER

ITEMMASTER.ANALYSISGROUP = 'Materials'

Active For All Users




On Insert and Update when Blank:


Suppose we want to default the field JOBCATEGORY value to "Repair" if that field is left blank when a new Job is added or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

JOBHEADER

JOBCATEGORY

On Insert and Update when Blank

Repair



Active For All Users




Suppose we want to default the field SALESPERSON value to "Jane Steel" if that field is left blank and when the Customer Region is set to 'Asia' when a new Customer or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

CUSTOMERMASTER

SALESPERSON

On Insert and Update when Blank

Jane Steel

CUSTOMERMASTER

CUSTOMERREGIONCODE = 'Asia'

Active For All Users




Suppose we want to default the Job field SALESPERSON value to "Bob Drum" if that field is left blank and when the Job Customers Customer Type is set to 'Services' and where the Job Category is set to 'Plumbing' when a new Job Order is Created or updated. (Note the optional use of an alias of 'CM' on the CUSTOMERMASTER table)


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

JOBHEADER

SALESPERSON

On Insert and Update when Blank

Bob Drum

JOBHEADER,

CUSTOMERMASTER CM

JOBHEADER.CUSTOMER = CM.CUSTOMER and CM.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 

Active For All Users




Suppose we want to default the Job field ADDITIONALFIELD_1 value to the current Customer Region field value of the Job Order Customer if that field is left blank and when the Job Category is set to 'Plumbing' when a new Job Order is Created or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

JOBHEADER

ADDITIONALFIELD_1

On Insert and Update when Blank

[CUSTOMERMASTER.CUSTOMEREGIONCODE]

JOBHEADER,

CUSTOMERMASTER

JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER  and JOBHEADER.JOBCATEGORY = 'Plumbing' 

Active For All Users


On Insert Always:


Suppose we want to force the field Workflow Status value to "Goods In Picking" when a new Sales Delivery is created.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

SALESDELIVERYHEADER

WORKFLOWSTATUS

On Insert Always

Goods In Picking



Active For All Users




Suppose we wish to influence the Job Order Status when we create a new Job for an Asset which has an Asset Type = 'Equipment'. In this example after the order is initially created we will update the Order Status to 'Quote' if the Condition is met. 


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

JOBHEADER

ORDERSTATUS

On Insert Always

Quote

JOBHEADER, CUSTOMERASSETMASTER

JOBHEADER.CUSTOMER = CUSTOMERASSETMASTER.CUSTOMER and 

JOBHEADER.PROJECTORASSET = CUSTOMERASSETMASTER.CUSTASSETNAME and CUSTOMERASSETMASTER.CUSTASSETTYPE = 'Equipment' 

Active For All Users



On Insert and Update Always:


Suppose we always want to force a field value of "Assembly" to the SOURCEDBY field if the Item Category = 'Wagons'


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

Rule Status

Restricted User

ITEMMASTER

SOURCEDBY

On Insert and Update Always

Assembly

ITEMMASTER

ITEMMASTER.ITEMCATEGORY = 'Wagons'

Active For All Users