Add a field to a record page using an existing column
Add a Country field to the contact profile on the contact page. The contact object schema already includes the column that corresponds to the Country field of the contact page.
Create a replacing view model schema of the contact page
-
Go to the Configuration section and select a custom package to add the schema.
-
Click Add → Replacing view model on the section list toolbar.
-
Fill out the schema properties.
- Set Code to "ContactPageV2."
- Set Title to "Display schema - Contact card."
- Select "ContactPageV2" in the Parent object property.
-
Set up the field layout. To do this, add a configuration object with the settings that determine the field layout to the
diff
array of modifications.View the source code of the replacement view model of the contact page below.
ContactPageV2define("ContactPageV2", [], function() {
return {
/* The name of the record page object's schema. */
entitySchemaName: "Contact",
/* Display the field on the record page. */
diff: [
/* Properties to add a [Country] field to the page. */
{
/* Add the element to the page. */
"operation": "insert",
/* The meta name of the parent container to add the field. */
"parentName": "ProfileContainer",
/* Add the field to the element collection of the parent element. */
"propertyName": "items",
/* The meta name of the field to add. */
"name": "Country",
/* The properties to pass to the element's constructor. */
"values": {
/* Set the field type to lookup. */
"contentType": Terrasoft.ContentType.LOOKUP,
/* Set up the field layout. */
"layout": {
/* The column number. */
"column": 0,
/* The row number. */
"row": 6,
/* The column span. */
"colSpan": 24
}
}
}
]
};
}); -
Click Save on the Designer's toolbar.
Outcome of the example
To view the outcome of the example, refresh the Contacts section page.
As a result, Creatio will add a Country field to the contact profile on the contact page.