When dynamic creation is enabled, entering a nonexistent value in a reference field
creates a new record on the referenced table instead of returning an error.
시작하기 전에
Role required: personalize_dictionary
이 태스크 정보
By default, a user must enter a value in a reference field that matches an existing
record in the table that the reference field refers to. For example, the
Caller field in an Incident must have a value that is an
existing user. You can enable dynamic creation to create a new record on the
referenced table when a user enter a nonexistent value in a reference field instead
of returning an error.
프로시저
-
Right-click the field label in the form and select Configure
Dictionary.
-
Populate the following fields (you may need to configure the Dictionary
form):
- dynamic_creation: Select the check box.
- dynamic_creation_script: Enter a script that
dynamically creates the record.
-
Click Update.
Examples:
You could use the following
dynamic_creation_script to create a record on the
referenced
table.
current.name = value;
current.insert();
주: The
parent object can be used to access anything from the parent record.
You could create a script include named
MyUserReferenceCreator with the following
contents:
var MyUserReferenceCreator = Class.create();
MyUserReferenceCreator.prototype = {
initialize: function() {
},
create: function(current, value) {
current.name=value;
return current.insert();
},
type: 'MyUserReferenceCreator'
}
When
the script include is created, the following
dynamic_creation_script generates a new location for an
invalid reference field
value:
new MyUserReferenceCreator().create(current, value);