Creatio development guide
PDF
This documentation is valid for Creatio version 7.11.0. We recommend using the newest version of Creatio documentation.

Adding the [Attachments] detail to the section in mobile application (version 7.11.2)

Glossary Item Box

ATTENTION

This article is valid for bpm'online 7.11.2 and above, and mobile aplication 7.11.3 and above.

Introduction

The [Attachments] detail is used to store files and web-links connected to corresponding section record. Detail is available in all bpm’online sections (see “How to work with attachments and notes”) and in the [Opportunities] section of mobile application.

The [Attachments] detail is implemented in the mobile application via embedded detail. The embedded detail is used to facilitate the data edit process without opening the separate page.

Steps to add a detail to the record page in the section of mobile application:

1. Create section schema and define an embedded detail based on the object for the [Attachments] detail.

2. Add information about new schemas to the mobile application manifest.

Case description

Add the [Attachments] detail on the edit page of the [Contacts] section of mobile application.

Case implementation algorithm

1. Create section schema and define an embedded detail there

Create a new module schema in the [Configuration] section of a custom package with the following property values:

  • [Title] – "UsrMobileContactModuleConfig".
  • [Name] – "UsrMobileContactModuleConfig".
  • [Package] – the name of the package used for development.

Add localized strings to the created schema (Fig. 1) with properties given in the table 1.

Fig. 1. Adding of the localizable string in the module schema designer

Table 1. Localizable string properties

Localizable string Value Description
ContactRecordPage_contactFilesDetail_Title Attachments Detail title.
ContactRecordPage_contactFilesDetail_Data File Field title for the file.
ContactRecordPage_contactFilesDetail_Link Link Field title for the web-link.

Add following source code on the [Source Code] tab of the schema in the module designer:

// Adding an embedded detail.
Terrasoft.sdk.RecordPage.addEmbeddedDetail("Contact", {
    name: "contactFilesDetail",
    position: 5,
    title: "ContactRecordPage_contactFilesDetail_Title",
    modelName: "ContactFile",
    primaryKey: "Id",
    foreignKey: "Contact",
    displaySeparator: false,
    generator: {
        xclass: "Terrasoft.FileAndLinksEmbeddedDetailGenerator",
        fileModel: "ContactFile"
    }
},
// An array of configuration objects of the detail columns.
[
    {
        name: "Data",
        displayColumn: "Name",
        label: "ContactRecordPage_contactFilesDetail_Data",
        placeHolder: "ContactRecordPage_contactFilesDetail_Data"
    },
    {
        name: "Type",
        hidden: true
    },
    {
        name: "Name",
        label: "ContactRecordPage_contactFilesDetail_Link",
        placeHolder: "ContactRecordPage_contactFilesDetail_Link",
        viewType: Terrasoft.ViewTypes.Url
    }
]);

// Adding default business rules.
Terrasoft.FileAndLinksEmbeddedDetailGenerator.addDefaultBusinessRules("ContactFile");

Save the schema to apply changes.

The process of calling the addEmbeddedDetail() method occurs here and the following values are passed as arguments:

  • Name of the main section object to which the detail will be added.
  • Configuration object of the detail properties.
  • Array of configuration objects of the properties of detail columns.

Also, the method of adding default business rules to the ContactFile schema is called.

2. Add information about new schemas to the mobile application manifest

The information about new schemas should be added to the mobile application manifest to apply the changes. For this, create the MobileApplicationManifestDefaultWorkplace extending schema in the custom package. Learn more about application manifest in the “Mobile application manifest” article. The procedure for creating a replacing client schema is covered in the “Creating a custom client module schema” article.

Add following source code on the [Source Code] tab of the MobileApplicationManifestDefaultWorkplace extending schema in the module designer:

{
    "SyncOptions": {
        "SysSettingsImportConfig": [],
        // Configuratio of the import of the required models.
        "ModelDataImportConfig": [
            // File type.
            {
                "Name": "FileType",
                "SyncColumns": []
            },
            //The [Attachment] detail object pf the [Contacts] section.
            {
                "Name": "ContactFile",
                "SyncByParentObjectWithRights": "Contact",
                "SyncColumns": [
                    "Contact",
                    "Type",
                    "Data",
                    "Size"
                ]
            }
        ]
    },
    // Used models.
    "Models": {
        "Contact": {
            // Configuration of the view mode.
            "Preview": "UsrMobileContactPreviewPage",
            // Configuration of the edit mode.
            "Edit": "UsrMobileContactEditPage",
            "RequiredModels": [
                "ContactFile",
                "FileType",
                "KnowledgeBase",
                "KnowledgeBaseFile"
            ],
            // Configuration of the section.
            "ModelExtensions": [
                "UsrMobileContactModuleConfig"
            ]
        }
    }
}

Save the schema to apply changes.

As a result, the [Attachments] detail will appear on the record page of the [Contacts] section (Fig. 2).

Fig. 2. The [Attachments] detail on the contact page

 

 

 

© bpm'online 2002-2018.

Did you find this information useful?

How can we improve it?