Skip to main content
Version: 8.0

Create records of a specific type using typified Freedom UI page

Level: intermediate
note

This functionality is available for Creatio 8.0.10 and later.

To implement the example:

  1. Set up the page UI. Read more >>>
  2. Set the record type available for creation. Read more >>>
  3. Lock the field on the page for adding records. Read more >>>
Example

Create an account of the "Customer" type only from the Accounts section.

1. Set up the page UI

  1. Open the Customer 360 app in the No-Code Designer.

  2. Open the Advanced settings tab in the No-Code Designer. To do this, click in the top right → "Application management" → "Application Hub" → Customer 360 app → "Advanced settings."

  3. Create a user-made package to add the schema. To do this, click Create new package → fill out the package properties → Save.

    For this example, create the sdkCreateSpecificAccount user-made package.

  4. Open the Accounts list page. To do this, click in the top right → Application managementApplication HubCustomer 360Accounts list page.

  5. Select the page field that determines the record type you can create.

    1. Select the New button on the working area of the Freedom UI Designer. This opens the element setup menu.
    2. Click . This opens the element setup area.
    3. Go to the Actions block.
    4. Click the Add field button. This opens the Select field window.
    5. Select the checkbox for the Type field.
    6. Click Select.
  6. Save the changes.

2. Set the record type available for creation

Configure the business logic in the Client Module Designer. For this example, set the record type available for creation.

  1. Open the source code of the Freedom UI page. To do this, click .

  2. Set up how to handle the action executed on button click.

    1. Find the ID of the "Customer" value in the Account types lookup. For this example, the ID is "03a75490-53e6-df11-971b-001d60e938c6."
    2. Go to the viewConfigDiff schema section → AddButton element.
    3. Bind the ID of the "Customer" value to the clicked button event.
    viewConfigDiff schema section
    viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
    /* Button that creates a new record. */
    {
    "operation": "merge",
    "name": "AddButton",
    "values": {
    /* Send the base request handler to open the new page of the "Account" entity. Populate the "Type" field using the "Customer" value. */
    "clicked": {
    "request": "crt.CreateRecordRequest",
    "params": {
    "entityName": "Account",
    "defaultValues": [
    {
    "attributeName": "Type",
    "value": "03a75490-53e6-df11-971b-001d60e938c6"
    }
    ]
    }
    },
    ...,
    }
    },
    ]/**SCHEMA_VIEW_CONFIG_DIFF*/,
  3. Save the changes.

As a result, the Type field on the New record window in the Accounts section will be populated by the "Customer" value, but it can be changed.

To forbid changing the field value, lock the Type field on the page for adding record from the Accounts section.

3. Lock the field on the page for adding records

  1. Find the page for adding records from the Accounts section.

    1. Open the Accounts list page. To do this, click in the top right → Application managementApplication HubCustomer 360Accounts list page.

    2. Go to the Actions block.

    3. Click View pages setup link. This opens the Pages setup window.

    4. Find the name of page for adding records in the Page for adding record field.

      For this example, the name of the page for adding records is Accounts mini page.

    5. Close the page.

  2. Open the Accounts mini page. To do this, click in the top right → Application managementApplication HubCustomer 360Accounts mini page.

  3. Lock the page field that includes the record type you can create.

    1. Select the Type field on the working area of the Freedom UI Designer. This opens the element setup menu.
    2. Click . This opens the element setup area.
    3. Go to the Editability block.
    4. Select the Read-only checkbox.
  4. Save the changes.

View the result

  1. Open the Accounts section.
  2. Click New.

As a result:

  • Creatio will populate the Type field on the New record window in the Accounts section using the "Customer" non-editable value.
  • You will be able to create an account of the "Customer" type only. View the result >>>

Source code

/* Declare the AMD module. */
define("Accounts_ListPage", /**SCHEMA_DEPS*/[]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/()/**SCHEMA_ARGS*/ {
return {
viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
/* Button that creates a new record. */
{
"operation": "merge",
"name": "AddButton",
"values": {
/* Send the base request handler to open the new page of the "Account" entity. Populate the "Type" field using the "Customer" value. */
"clicked": {
"request": "crt.CreateRecordRequest",
"params": {
"entityName": "Account",
"defaultValues": [
{
"attributeName": "Type",
"value": "03a75490-53e6-df11-971b-001d60e938c6"
}
]
}
},
"caption": "#ResourceString(AddButton_caption)#",
"visible": true,
"clickMode": "default"
}
},
{
"operation": "remove",
"name": "SearchFilter",
"properties": [
"targetAttributes"
]
},
{
"operation": "merge",
"name": "SearchFilter",
"values": {
"_filterOptions": {
"expose": [
{
"attribute": "SearchFilter_Items",
"converters": [
{
"converter": "crt.SearchFilterAttributeConverter",
"args": [
"Items"
]
}
]
}
],
"from": [
"SearchFilter_SearchValue",
"SearchFilter_FilteredColumnsGroups"
]
}
}
}
]/**SCHEMA_VIEW_CONFIG_DIFF*/,
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
{
"operation": "merge",
"path": [
"attributes",
"Items",
"modelConfig"
],
"values": {
"filterAttributes": [
{
"loadOnChange": true,
"name": "FolderTree_active_folder_filter"
},
{
"name": "Items_PredefinedFilter",
"loadOnChange": true
},
{
"name": "SearchFilter_Items",
"loadOnChange": true
}
]
}
}
]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,
modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[]/**SCHEMA_MODEL_CONFIG_DIFF*/,
handlers: /**SCHEMA_HANDLERS*/[]/**SCHEMA_HANDLERS*/,
converters: /**SCHEMA_CONVERTERS*/{}/**SCHEMA_CONVERTERS*/,
validators: /**SCHEMA_VALIDATORS*/{}/**SCHEMA_VALIDATORS*/
};
});

Resources

Package with example implementation