defaultFields/defaultValues

Comma-separated lists of fields and values that are automatically entered when creating (or updating) a record.

Syntax

defaultFields: A comma-separated list of fields (<field name or number>) that receive the values defined in defaultValues.

defaultValues: A comma-separated list of values to be used.

If a value contains a comma, you need to escape it with \. Quotes are not supported as string delimiters.

Specify catalog values as #<catalogCode>. Use #<childCode>~#<parentCode> to specify values of hierarchical catalogs. For variable catalogs you can also specify the external key using the syntax EXT:<external key> (e.g. EXT:100_4_61).

Specify values for Boolean fields as true and false.

defaultValues supports the following variables: $curRep, $curOrgGroup, $curMyLeader, $curSuperior, $curMyDeputy, $curExtGroup, LOGINLANGUAGE.

Example (KM)

defaultFields = FreeC1,FreeC2,Product,Problem,Status,ProcessedByID,FreeL1,FreeL2

defaultValues = my text,my other text\, including a comma...,#1~#8,#2~#1,#1,$curRep,true,false

Escaping commas and quotes in the default values

In the above example for the default value for the FreeC2 field includes the comma by escaping it. Similarly, to include the single quote in a default value, you have to ensure that the single quote is escaped in a safe manner. Consider the following example, for a merge process. To get the default value of a record, instead of using a value like this:

"2:'"+$.get('2')+"';5:'"+$.get('5')+"'; 8:'"+$.get('8')+"'; 1:'"+$.get('1')+"';<>;"

use: [2,5,8,1].map(function(fieldId){ return fieldId + ":" + JSON.stringify($.get(fieldId)); }).join(";") + ":<>;"

This will ensure that the single quote is escaped properly and the default value is rendered correctly.

Note: For Expand actions with mode = New CRM.Core default values (i.e. default values defined in the Aurea CRM win Rights module) are applied but will be overwritten by defaultFields / defaultValues, if defined. For Expand actions with mode = Update CRM.Core default values are not applied.
Note: You can not enter the key (station number plus serial number) of a parent record via defaultValues. Since the business logic may depend on a valid parent record (e.g. when creating a new ticket) creating new (child) records requires a valid parent link, >> link/linkId/link2/linkId2.