Case description:

We want to add lookup with edit page.

This lookup looks like this:

Edit page:

How to do it:

1) Create section schema with parent object “Base lookup configuration section” and add method “addRecord” if you want to open edit page when you click on “New” button.

Example:

For example I created object schema “Automobile” with columns: Manufacturer (Text), Brand (Text), Date of issue (Date), Country of issue (Lookup: Country):

After that I created new Schema of the Section View Model for lookup and set parent object “Base lookup configuration section”:

And added next code to “Source code”:

define("GlbAutomobileLookupSectionV2", ["ConfigurationEnums", "ConfigurationGrid", "ConfigurationGridGenerator",
    "ConfigurationGridUtilities"],
    function(ConfigurationEnums) {
        return {
            entitySchemaName: "GlbAutomobile",
            attributes: {},
            diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
            messages: {},
            methods: {
                addRecord: function(typeColumnValue) {
                    if (!typeColumnValue) {
                        if (this.get("EditPages").getCount() > 1) {
                            return false;
                        }
                        var tag = this.get("AddRecordButtonTag");
                        typeColumnValue = tag || this.Terrasoft.GUID_EMPTY;
                    }
                    var schemaName = this.getEditPageSchemaName(typeColumnValue);
                    if (!schemaName) {
                        return;
                    }
                    this.openCardInChain({
                        schemaName: schemaName,
                        operation: ConfigurationEnums.CardStateV2.ADD,
                        moduleId: this.getChainCardModuleSandboxId(typeColumnValue)
                    });
                }
            }
        };
    });

If you don’t want open edit page when you click on “New” button then remove method “addRecord”:

define("GlbAutomobileLookupSectionV2", ["ConfigurationEnums", "ConfigurationGrid", "ConfigurationGridGenerator",
    "ConfigurationGridUtilities"],
    function(ConfigurationEnums) {
        return {
            entitySchemaName: "GlbAutomobile",
            attributes: {},
            diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
            messages: {},
            methods: {}
        };
    });

Saved schema.

2) Create edit page schema with parent object “Base lookup page”. And add your controls.

Example:

Created new Schema of the Edit Page View Model for lookup and set parent object “Base lookup page”

And added next code to “Source code” with columns of my object:

define("GlbAutomobileLookupEditPageV2", [],
    function() {
        return {
            entitySchemaName: "GlbAutomobile",
            details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
            attributes: {},
            methods: {},
            rules: {},
            diff: /**SCHEMA_DIFF*/[
                {
                    "operation": "merge",
                    "name": "Name",
                    "parentName": "GeneralInfoControlGroup",
                    "propertyName": "items",
                    "values": {
                        "layout": {
                            "colSpan": 12,
                            "column": 0,
                            "row": 0
                        }
                    }
                },
                {
                    "operation": "insert",
                    "name": "GlbManufacturer",
                    "values": {
                        "layout": {
                            "colSpan": 12,
                            "rowSpan": 1,
                            "column": 0,
                            "row": 2,
                            "layoutName": "GeneralInfoControlGroup"
                        },
                        "bindTo": "GlbManufacturer"
                    },
                    "parentName": "GeneralInfoControlGroup",
                    "propertyName": "items",
                    "index": 1
                },
                {
                    "operation": "insert",
                    "name": "GlbBrand",
                    "values": {
                        "layout": {
                            "colSpan": 12,
                            "rowSpan": 1,
                            "column": 0,
                            "row": 3,
                            "layoutName": "GeneralInfoControlGroup"
                        },
                        "bindTo": "GlbBrand"
                    },
                    "parentName": "GeneralInfoControlGroup",
                    "propertyName": "items",
                    "index": 1
                },
                {
                    "operation": "insert",
                    "name": "GlbDateOfIssue",
                    "values": {
                        "layout": {
                            "colSpan": 12,
                            "rowSpan": 1,
                            "column": 0,
                            "row": 4,
                            "layoutName": "GeneralInfoControlGroup"
                        },
                        "bindTo": "GlbDateOfIssue"
                    },
                    "parentName": "GeneralInfoControlGroup",
                    "propertyName": "items",
                    "index": 1
                },
                {
                    "operation": "insert",
                    "name": "GlbCountryIssue",
                    "values": {
                        "layout": {
                            "colSpan": 12,
                            "rowSpan": 1,
                            "column": 0,
                            "row": 5,
                            "layoutName": "GeneralInfoControlGroup"
                        },
                        "bindTo": "GlbCountryIssue"
                    },
                    "parentName": "GeneralInfoControlGroup",
                    "propertyName": "items",
                    "index": 1
                }
            ]/**SCHEMA_DIFF*/
        };
    });

Saved schema.

3) Register edit page in your database by SQL script.

Example:

DECLARE
-- Name of edit page schema.
@CardSchemaName NCHAR(100) = 'GlbAutomobileLookupEditPageV2',
-- Name of object schema.
@EntitySchemaName NCHAR(100) = 'GlbAutomobile',
-- Caption of your page.
@PageCaption NCHAR(100) = 'Automobiles lookup pagee',
-- Empty string.
@Blank NCHAR(100) = ''
 
-- Adding record in table SysModuleEntity.
INSERT INTO SysModuleEntity(
    ProcessListeners,
    SysEntitySchemaUId
)
VALUES(
    0,
    (SELECT TOP 1 UId
    FROM SysSchema
    WHERE Name = @EntitySchemaName
    )
)
 
-- Adding record in table SysModuleEdit
INSERT INTO SysModuleEdit(
    SysModuleEntityId,
    UseModuleDetails,
    Position,
    HelpContextId,
    ProcessListeners,
    CardSchemaUId,
    ActionKindCaption,
    ActionKindName,
    PageCaption
)
VALUES (
    (SELECT TOP 1 Id
    FROM SysModuleEntity
    WHERE SysEntitySchemaUId = (
        SELECT TOP 1 UId
        FROM SysSchema
        WHERE Name = @EntitySchemaName
        )
    ),
    1,
    0,
    @Blank,
    0,
    (SELECT TOP 1 UId
     FROM SysSchema
     WHERE name = @CardSchemaName
    ),
    @Blank,
    @Blank,
    @PageCaption
)

And add record in Localizable string table. For it you should know your RecordId by special query

Example:

I need add localizable string in table “SysModuleEditLcz” by next SQL script:

DECLARE
-- Caption of your page.
@PageCaption NCHAR(100) = 'Automobiles lookup pagee'
 
-- SysCultureId - Id for en-US from table SysCulture
INSERT INTO SysModuleEditLcz(Id, ModifiedOn, RecordId, SysCultureId, ActionKindCaption, PageCaption)
    VALUES(NEWID(), GETUTCDATE(), 'RecordId you can get by script below', 'A5420246-0A8E-E111-84A3-00155D054C03', 'Add', @PageCaption)

Here I need “RecordId” and use next script to know it:

SELECT sme.Id, sme.CreatedOn
                --SELECT DISTINCT sme.Id, sme.CreatedOn
                FROM SysModuleEdit as sme
                    JOIN SysModuleEntity as sment on sment.Id = sme.SysModuleEntityId
                    JOIN SysSchema as sse on sse.UId = sment.SysEntitySchemaUId
                    JOIN SysSchema as ss on ss.UId = sme.CardSchemaUId
                WHERE sse.Name = 'GlbAutomobile'
                    AND ss.Name = 'GlbAutomobileLookupEditPageV2'
                ORDER BY sme.CreatedOn DESC

And i have got RecordId:

After that I execute script above with RecordId:

4) Register lookup in system and choose your section in "List page" field.

Example:

As result, I have Lookup with Edit Page:

When I click “Add”, it opens my edit page (Because I added method “addRecord” in schema “GlbAutomobileLookupSectionV2”. If you don’t want it – remove this method):

Like 1

Like

Share

1 comments

Tatiana Rogova, this article is really helpful. It would be of more useful if the scripts are shared for other db as well - PostgreSQL . Kindly consider this. 

Show all comments

Case description:

Inserting different fields in the same place, depending on the values of the other field

Algorithm of realization:

  1. Create replacing client schema for your page.
  2. Insert container into the place, where you want to have that fields. Write following code into "diff"

    {
        "operation": "insert",
        "name": "MyContainer",
        "parentName": "Header",
        "propertyName": "items",
        "values": {
            "layout": {"column": 0, "row": 3, "colSpan": 12},
            "itemType": Terrasoft.ViewItemType.CONTAINER,
            "items": []
        }
    }

     

  3. Add visibility attributes for each field and define onChange handler for field which will change fields in your container. Write following code into "attributes":

    "Field1Visible": {
        "dataValueType": Terrasoft.DataValueType.BOOLEAN,
        "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN
    },
    "Field2Visible": {
        "dataValueType": Terrasoft.DataValueType.BOOLEAN,
        "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN
    },
    "MainField": {
        "onChange": "onMainFieldChanged"
    }

     

  4. Insert your fields and bind their visibility to added attributes. Important! "parentName" must be equal to name of container which was added at the step 2:

    {
        "operation": "insert",
        "name": "Field1",
        "values": {
            "visible": {"bindTo": "Field1Visible"},
            "bindTo": "Field1"
        },
        "parentName": "MyContainer",
        "propertyName": "items",
        "index": 2
    },
    {
        "operation": "insert",
        "name": "Field2",
        "values": {
            "visible": {"bindTo": "Field2Visible"},
            "bindTo": "Field2"
        },
        "parentName": "MyContainer",
        "propertyName": "items",
        "index": 1
    }

     

  5. Add two methods: onMainFieldChange and method which will set visibility of you fields.

    setVisibility: function() {
        this.set("Field1Visible", false);
        this.set("Field2Visible", false);
     
        var param = this.get("MainField");
     
        if (param === "SomeValue") {
            this.set("Field1Visible", true);
        } else {
            this.set("Field2Visible", true);
        }
    },
    onStdNameChanged: function() {
        this.setVisibility();
    }

     

Like 1

Like

Share

0 comments
Show all comments

Question

How can I make the [Resolution] field of a case page required? 

Answer

The issue is that an HTML-control of a RICHTEXT type, which is the [Resolution] field, does not support business rule functionality.

Nevertheless, you can use a work-around solution. Override the save() method and verify whether the specified field is populated therein, as follows;

save: function () {
    if (this.get("Solution")) {
        this.callParent(arguments);
    } else {
        this.showInformationDialog("Populate the [Resolution] field");
    }
}

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

Uncaught TypeError: Cannot read property 'PrimaryColumnName'

Cause

The "Products" section has been added through the mobile application wizard

Solution

It is necessary to make changes to the "Products" section, namely re-saving the list and card settings.

Necessary conditions

Admin rights

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

When I set up the mobile app, all objects work fine, except for "Activity". When I try to access an activity, the following error is displayed - Uncaught TypeError:Cannot read property “modelName” of undefined.

I tried to delete all columns to add them again (thought maybe the "Type" column is causing this issue) - it didn't work. 

Once I changed the settings, I re-distributed access rights, cleared the cache and re-synchronized with the database. 

Solution

Some of the fields were removed on the activity card, and, most importantly, the “Participants” detail was removed. This detailed is required for correct operation of the "Activities" section.

By default, bpm'online only syncs the activities with the current user specified on the “Participants” detail.

If this detail is removed, the activities may not sync correctly.

A workaround for deleted objects used in parent packages:

- Create a custom schema (e.g., "MobileUtilitiesCustom").

Ext.define("Terrasoft.sdk.RecordPageMetadataApplier.Override", {
 
                override: "Terrasoft.sdk.RecordPageMetadataApplier",
 
 
 
                addEmbeddedDetail: function(modelName, operation) {
 
                               this.embeddedDetails[operation.name] = operation.values;
 
                               var values = operation.values;
 
                               var filter = values.filter;
 
                               var detailName = operation.name;
 
                               Terrasoft.sdk.RecordPage.addEmbeddedDetail(modelName, {
 
                                               name: detailName,
 
                                               title: values.caption,
 
                                               position: values.position,
 
                                               modelName: values.entitySchemaName,
 
                                               primaryKey: filter.masterColumn,
 
                                               foreignKey: filter.detailColumn,
 
                                               hidden: values.hidden
 
                               });
 
                },
 
 
 
                applyMetadata: function() {
 
                               this.callParent(arguments);
 
                               for (var itemName in this.removedMetadataItems) {
 
                                               if (!Terrasoft.util.isGuid(itemName) && Terrasoft.util.String.contains(itemName, "EmbeddedDetail")) {
 
                                                               this.addEmbeddedDetail(this.modelName, {
 
                                                                              name: itemName,
 
                                                                              values: {
 
                                                                                              entitySchemaName: itemName.substring(0, itemName.indexOf("Detail")),
 
                                                                                              filter: {
 
                                                                                                              masterColumn: "Id",
 
                                                                                                              detailColumn: "Id"
 
                                                                                              },
 
                                                                                              hidden: true
 
                                                                              }
 
                                                               });
 
                                               }
 
                               }
 
                }
 
});
 
 
 
Terrasoft.sdk.RecordPage.configureColumn = function(model, columnSetName, columnName, columnConfig) {
 
                var modelConfig = Terrasoft.ApplicationConfig.getModelConfig(model);
 
                var columnSetConfig = modelConfig.columnSets.get(columnSetName);
 
                if (!columnSetConfig) {
 
                               return;
 
                }
 
                var columnSetColumns = Terrasoft.sdk.RecordPage.getColumns(model, columnSetName);
 
                if (!columnSetColumns) {
 
                               return;
 
                }
 
                var columnSetColumn = columnSetColumns.get(columnName);
 
                var columnOriginalConfig;
 
                if (columnSetColumn) {
 
                               columnOriginalConfig = columnSetColumn.columnOriginalConfig;
 
                } else {
 
                               columnOriginalConfig = {};
 
                               columnConfig.hidden = true;
 
                               var modelInstance = Ext.ClassManager.get(columnSetConfig.modelName || model);
 
                               var realModelColumnConfig = modelInstance.ColumnConfigs.get(columnName);
 
                               columnConfig.columnType = realModelColumnConfig.columnType;
 
                               columnConfig.name = columnName;
 
                }
 
                Ext.merge(columnOriginalConfig, columnConfig);
 
                var contextModel = columnSetConfig.modelName || model;
 
                if (columnConfig.hidden) {
 
                               var columns = this.getColumnSetColumns(model, columnSetName);
 
                               columns.remove(columnName);
 
                } else {
 
                               var resolvedColumnConfig = this.resolveColumnConfig(contextModel, columnOriginalConfig,
 
                                                               !!columnSetConfig.modelName);
 
                               columnSetConfig.columns.configure(columnName, resolvedColumnConfig);
 
                }
 
};
 
 
 
Terrasoft.sdk.RecordPage.addColumn = function(model, columnConfig, columnSetName) {
 
                var modelConfig = Terrasoft.ApplicationConfig.getModelConfig(model);
 
                if (!columnSetName) {
 
                               columnSetName = modelConfig.primaryColumnSetName;
 
                }
 
                var columnSetConfig = modelConfig.columnSets.get(columnSetName);
 
                if (!columnSetConfig) {
 
                               return;
 
                }
 
                var contextModel = columnSetConfig.modelName || model;
 
                var isEmbeddedDetail = !!columnSetConfig.modelName;
 
                if (!columnConfig.hidden) {
 
                               columnSetConfig.columns.add(this.resolveColumnConfig(contextModel, columnConfig, isEmbeddedDetail));
 
                }
 
                this.addColumnToQueryConfig(model, columnConfig.name, columnSetName, isEmbeddedDetail);
 
                if (columnConfig.displayColumn) {
 
                               this.addColumnToQueryConfig(model, columnConfig.displayColumn, columnSetName, isEmbeddedDetail);
 
                }
 
};

- In the mobile application manifest (e.g., "UsrMobileApplicationManifestCustomMobile") specify the custom schema.

Like 0

Like

Share

0 comments
Show all comments

Question

Is there a way to allow locked fields to be edited by certain groups?

Answer

You can do it this way:

1. Open the ‘Opportunity’ section, click ‘View’ and select ‘Open section wizard’:

2. Select ‘Page’:

3. Select a field you want to make editable and click ‘Edit’:

4. Clear the ‘Read-only’ checkbox:

This will make the field editable. Now you need to make it editable by certain groups only.

1. To do this, open ‘System designer’:

2. Select "Object permissions":

3. Select "Sections":

4. Find the ‘Opportunity’ string and if the ‘Managed by columns’ is marked with an ‘X’ – click it. It should look as follows:

5. Select the ‘Opportunity’ string and scroll down to the bottom of the page, where you can find ‘Columns permissions’. You need to find the field you want to make editable by certain groups (the "Type" field is used in this example, but you can choose any other):

6. You will see the role and the role permission level on the right:

7. Click ‘New’ to add permissions for a user or a role and click an icon in the "Access level" column. The eye sign allows only to read, the pen sign allows to edit and the X sign doesn’t allow any access to this column.

You need to set it as follows:

The necessary conditions:

System administrator rights.

Like 0

Like

Share

0 comments
Show all comments

Question

Receiving messages does not work. Version 7.7.

methods: {
    editRecord: function(editPageUId) {
        this.callParent(arguments);
        var text = "ilaySchema6Detail";
        this.sandbox.publish("PublishDetailName", text);
    }
},
messages: {
    "PublishDetailName": {
        "mode": this.Terrasoft.MessageMode.BROADCAST,
        "direction": this.Terrasoft.MessageDirectionType.PUBLISH
    }
}
methods: {
    subscribeSandboxEvents: function() {
        this.callParent(arguments);
        this.sandbox.subscribe("PublishDetailName", this.getDetailNameFromWhoOpen, this); 
    },
    getDetailNameFromWhoOpen: function(detailName) {
        var a = 5;
    }
},
messages: {
    "PublishDetailName": {
        "mode": this.Terrasoft.MessageMode.BROADCAST,
        "direction": this.Terrasoft.MessageDirectionType.SUBSCRIBE
    }
}

The getDetailNameFromWhoOpen() method cannot be called.

Answer

The issue is that you publish the message before (!) the detail edit page is open. When the page is open, you perform subscription. But the moment is lost. You subscribe to the message when noone will publish it.

You need to execute publish on the edit page, taking the result as a variable.

In the detail schema, execute subscribe, whose handler must be the function returning the value.

Example.

Detail schema:

define("ilaySchema6Detail", [], function() {
    return {
        entitySchemaName: "ilayRecomendation",
        details: /**SCHEMA_DETAILS*/{
        }/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[
        ]/**SCHEMA_DIFF*/,
        methods: {
            addRecord: function(editPageUId) {
                this.callParent(arguments);
            },
            init: function() {
                this.callParent(arguments);
                console.log("id in detail: " + this.sandbox.id);
                this.sandbox.subscribe("PublishDetailName",
                    this.getDetailNameFromWhoOpen, this,
                    [this.sandbox.id]
                );
            },
            getDetailNameFromWhoOpen: function() {
                return {
                    param: "test!"
                };
            }
        },
        messages: {
            "PublishDetailName": {
                mode: Terrasoft.MessageMode.PTP,
                direction: Terrasoft.MessageDirectionType.SUBSCRIBE
            }
        }
    };
});

Page schema:

define("ilayilayRecomendation1Page", [], function() {
    return {
        entitySchemaName: "ilayRecomendation",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[
        ]/**SCHEMA_DIFF*/,
        methods: {
            onEntityInitialized: function() {
                this.callParent(arguments);
                var res = this.sandbox.publish("PublishDetailName",
                    null,
                    [this.getDetailId()]
                );
                alert(res.param);
            },
            getDetailId: function() {
                var index = this.sandbox.id.indexOf("ilayilayRecomendation1Page");
                var newId = this.sandbox.id.substring(0, index);
                console.log("id in page: " + newId);
                return newId;
            },
        },
        rules: {},
        messages: {
            "PublishDetailName": {
                mode: Terrasoft.MessageMode.PTP,
                direction: Terrasoft.MessageDirectionType.PUBLISH
            }
        },
        attributes: {
        }
    };
});

 

Like 0

Like

Share

0 comments
Show all comments

Case description:

We want to add tab with attachments and notes into custom section.

This tab looks like this:

Figure 0. "Attachment and notes" tab on contact page.

Algorithm of realization:

  1. Create object which will represent file object in DataBase (ex. ContactFile object in base packages). This object can be exist.
    • You should create new Object and configure it like at next figure:

      Figure 1. Configuration of custom file object.



      IMPORTANT!!! This object must be inherited from File (Base)

       
  2. Add "Notes" field to your section object. It must be multi-line string and have unlimited length 
  3. Add detail to client schema of your page in details section

    Files: {
        schemaName: "FileDetailV2",
        entitySchemaName: "ContactFile", //Name of your object which represent file which connected with you main object
        filter: {
            masterColumn: "Id",
            detailColumn: "Contact"
        }
    },

     

  4. Add code for "define tab", "attachment detail" and "notes field group" in your page. This code you should insert in diff section of your client schema.

     Collapse source

    {
        "operation": "insert",
        "name": "NotesAndFilesTab",
        "parentName": "Tabs",
        "propertyName": "tabs",
        "index": 3,
        "values": {
            "caption": {"bindTo": "Resources.Strings.NotesAndFilesTabCaption"},
            "items": []
        }
    },
    {
        "operation": "insert",
        "parentName": "NotesAndFilesTab",
        "propertyName": "items",
        "name": "Files",
        "values": {
            "itemType": Terrasoft.ViewItemType.DETAIL
        }
    },
    {
        "operation": "insert",
        "name": "NotesControlGroup",
        "parentName": "NotesAndFilesTab",
        "propertyName": "items",
        "values": {
            "itemType": Terrasoft.ViewItemType.CONTROL_GROUP,
            "items": [],
            "caption": {"bindTo": "Resources.Strings.NotesGroupCaption"}
        }
    },
    {
        "operation": "insert",
        "parentName": "NotesControlGroup",
        "propertyName": "items",
        "name": "Notes", //Name of notes field in your main object
        "values": {
            "contentType": Terrasoft.ContentType.RICH_TEXT,
            "layout": {"column": 0, "row": 0, "colSpan": 24},
            "labelConfig": {
                "visible": false
            },
            "controlConfig": {
                "imageLoaded": {
                    "bindTo": "insertImagesToNotes"
                },
                "images": {
                    "bindTo": "NotesImagesCollection"
                }
            }
        }
    }

     

  5. Add localizable strings to resources of your client schema:

    1. NotesAndFilesTabCaption - tab caption 

    2. NotesGroupCaption - notes group caption

  6. IMPORTANT!!! If you have some troubles try to clear browser cache, redis, recompile schemas in bpm'online or restart web-site.  
Like 1

Like

Share

0 comments
Show all comments
  • Add new operation permission “CanManageAccessRight” and add roles who have access.

     
  • Create replacing client module for "Section base schema":

     

BaseSectionV2 schema code

define("BaseSectionV2", [], function() {
    return {
        attributes: {
            "CanManageAccessRight": {
                dataValueType: this.Terrasoft.DataValueType.BOOLEAN
            }
        },
        messages: {
            "UpdateCanManageAccessRight": {
                "mode": Terrasoft.MessageMode.PTP,
                "direction": Terrasoft.MessageDirectionType.SUBSCRIBE
            }
        },
        methods: {
            subscribeSandboxEvents: function() {
                this.callParent(arguments);
                this.sandbox.subscribe("UpdateCanManageAccessRight", function(result) {
                    this.set("CanManageAccessRight", result);
                }, this, [this.getCardModuleSandboxId()]);
            },
            getSchemaAdministratedByRecords: function() {
                return this.callParent(arguments) && this.get("CanManageAccessRight");
            }
        }
    };
});
  • Create replacing client module for "Base card schema":

     

BasePageV2 schema code

define("BasePageV2", ["RightUtilities"], function(RightUtilities) {
    return {
        attributes: {
            "CanManageAccessRight": {
                dataValueType: this.Terrasoft.DataValueType.BOOLEAN
            }
        },
        messages: {
            "UpdateCanManageAccessRight": {
                "mode": Terrasoft.MessageMode.PTP,
                "direction": Terrasoft.MessageDirectionType.BIDIRECTIONAL
            }
        },
        methods: {
            init: function() {
                this.callParent(arguments);
                this.checkCanManageAccessRight();
            },
            checkCanManageAccessRight: function() {
                RightUtilities.checkCanExecuteOperation({operation: "CanManageAccessRight"}, function(result) {
                    this.set("CanManageAccessRight", result);
                    this.sandbox.publish("UpdateCanManageAccessRight", result, [this.sandbox.id]);
                }, this);
            },
            subscribeSandboxEvents: function() {
                this.callParent(arguments);
                this.sandbox.subscribe("UpdateCanManageAccessRight", function() {
                    return this.get("CanManageAccessRight");
                }, this, this.getDetailIds());
            },
            getSchemaAdministratedByRecords: function() {
                return this.callParent(arguments) && this.get("CanManageAccessRight");
            }
        }
    };
});
  • Create replacing client module for "Base schema - Detail with list":

     

BaseGridDetailV2 schema code

define("BaseGridDetailV2", [], function() {
    return {
        attributes: {
            "CanManageAccessRight": {
                dataValueType: this.Terrasoft.DataValueType.BOOLEAN
            }
        },
        messages: {
            "UpdateCanManageAccessRight": {
                "mode": Terrasoft.MessageMode.PTP,
                "direction": Terrasoft.MessageDirectionType.PUBLISH
            }
        },
        methods: {
            init: function() {
                this.callParent(arguments);
                var canManageAccessRight = this.sandbox.publish("UpdateCanManageAccessRight", null, [this.sandbox.id]);
                this.set("CanManageAccessRight", canManageAccessRight);
            },
            getSchemaAdministratedByRecords: function() {
                return this.callParent(arguments) && this.get("CanManageAccessRight");
            }
        }
    };
});

 

Like 5

Like

Share

0 comments
Show all comments

Question

I need to set up displaying of a date of adding a file to the "Files" detail.

Answer

Create a detail replacing schema:

define("FileDetailV2", ["ViewUtilities", "ConfigurationConstants", "ConfigurationEnums", "ImageListViewModel",
        "css!FileDetailCssModule"], function(ViewUtilities, ConfigurationConstants, ConfigurationEnums) {
    return {
        attributes: {
        },
        messages: {
        },
        methods: {
            getGridDataColumns: function() {
                var baseGridDataColumns = this.callParent(arguments);
                var gridDataColumns = {
                    "Type": {
                        path: "Type"
                    },
                    "Version": {
                        path: "Version"
                    }
                };
                return this.Ext.apply(baseGridDataColumns, gridDataColumns);
            }
        },
        diff: /**SCHEMA_DIFF*/[
            {
                "operation": "remove",
                "name": "DataGrid"
            },
            {
                "operation": "insert",
                "name": "DataGrid1",
                "parentName": "Detail",
                "propertyName": "items",
                "values": {
                    "itemType": Terrasoft.ViewItemType.GRID,
                    "listedZebra": true,
                    "collection": {"bindTo": "Collection"},
                    "activeRow": {"bindTo": "ActiveRow"},
                    "primaryColumnName": "Id",
                    "isEmpty": {"bindTo": "IsGridEmpty"},
                    "isLoading": {"bindTo": "IsGridLoading"},
                    "multiSelect": {"bindTo": "MultiSelect"},
                    "selectedRows": {"bindTo": "SelectedRows"},
                    "sortColumn": {"bindTo": "sortColumn"},
                    "sortColumnDirection": {"bindTo": "GridSortDirection"},
                    "sortColumnIndex": {"bindTo": "SortColumnIndex"},
                    "linkClick": {"bindTo": "linkClicked"},
                    "type": "listed",
                    "visible": {
                        "bindTo": "isImageManagerDetailView",
                        "bindConfig": {"converter": "getDataGridVisible"}
                    },
                    "listedConfig": {
                        "name": "DataGridListedConfig",
                        "items": [
                            {
                                "name": "NameListedGridColumn",
                                "bindTo": "Name",
                                "position": {
                                    "column": 1,
                                    "colSpan": 14
                                },
                                "type": Terrasoft.GridCellType.LINK
                            },
                            {
                                "name": "VersionListedGridColumn",
                                "bindTo": "Version",
                                "position": {
                                    "column": 15,
                                    "colSpan": 3
                                }
                            },
                            {
                                "name": "CreatedOnListedGridColumn",
                                "bindTo": "CreatedOn",
                                "position": {
                                    "column": 22,
                                    "colSpan": 2
                                }
                            }
                        ]
                    },
                    "tiledConfig": {
                        "name": "DataGridTiledConfig",
                        "grid": {
                            "columns": 24,
                            "rows": 3
                        },
                        "items": [
                            {
                                "name": "NameTiledGridColumn",
                                "bindTo": "Name",
                                "position": {
                                    "row": 1,
                                    "column": 1,
                                    "colSpan": 24
                                },
                                "type": Terrasoft.GridCellType.LINK
                            },
                            {
                                "name": "ModifiedByTiledGridColumn",
                                "bindTo": "ModifiedBy",
                                "position": {
                                    "row": 1,
                                    "column": 25,
                                    "colSpan": 12
                                }
                            },
                            {
                                "name": "VersionTiledGridColumn",
                                "bindTo": "Version",
                                "position": {
                                    "row": 1,
                                    "column": 27,
                                    "colSpan": 12
                                }
                            },
                            {
                                "name": "ModifiedOnTiledGridColumn",
                                "bindTo": "ModifiedOn",
                                "position": {
                                    "row": 1,
                                    "column": 39,
                                    "colSpan": 12
                                }
                            },
                            {
                                "name": "SizeTiledGridColumn",
                                "bindTo": "Size",
                                "position": {
                                    "row": 1,
                                    "column": 51,
                                    "colSpan": 12
                                }
                            }
                        ]
                    },
                    "linkClick": {"bindTo": "linkClicked"}
                }
            }
        ]   /**SCHEMA_DIFF*/
    };
});

 

Like 0

Like

Share

0 comments
Show all comments