Symptoms

The "Lookups" menu option in the system designer gets duplcated upon upgrading to version 7.6.0

Cause

A "Lookup" package that has been deleted from version 7.6.0 and whose contents have been transferred to other packages, remained in the system.

Solution

If no client logic is bound to the schemas of this package, delete the "Lookup" package dependencies to other configuration packages and afterwards delete the package itself.

Necessary conditions and possible resitrictions

Prior to getting down to the solution implementation, make a database backup. After you implement the solution, perform the "Compile all items" action. If there exists any client logic bound to the package, additional analysis is needed.

Like 0

Like

Share

0 comments
Show all comments

Case description:

We need to edit field of some record using custom action in the section. We will add 2 extra  fields (Warranty Period, Delivery Period) in the section. When we search product, We would like to realize the following function:

Section-> Actions-> Select multiple records > Change Warranty Period or Change Delivery Period. You can see it in the Figure 0.

Figure 0. Custom action using for data update.

In this case, there should be a small popup and I we change the value there.

Algorithm of realization.

  1. Create replacing page of section .
  2. Add localizable string like "Resources.Strings.MultiplyChangeAction" and bind this string to caption.



    Figure 1. Localizable string properties.



     
  3. Add function “isCustomActionEnabled” that determines conditions of the clickability of the action. This function determines whether the action is active. In our example, the action is active if at least an entry is selected.

     

    isCustomActionEnabled: function() {
                        var selectedRows = this.get("SelectedRows");
                        return selectedRows ? (selectedRows.length > 0) : false;
                    },  

     

  4. Add function "getSectionActions" is an owerriden virtual method in which to bind the handler method to an action. 

    getSectionActions: function() {
                        var actionMenuItems = this.callParent(arguments);
                        actionMenuItems.addItem(this.getButtonMenuItem({
                            "Caption": {bindTo: "Resources.Strings.MultiplyChangeAction"},
                            "Click": {bindTo: "showLoanInfo"},
                            "Enabled": {bindTo: "isCustomActionEnabled"}
                        }));
                        return actionMenuItems;
                    }

     

  5.  Add function "showLoanInfo" - action handler method which will show the user a window for data entry using "Terrasoft.utils.inputBox". After user clicks "OK", we need to update the record. 

    showLoanInfo: function() {
                    Terrasoft.utils.inputBox("Set fields for update", function(result, arg) {
                            if (result === Terrasoft.MessageBoxButtons.YES.returnCode) {
                                var warrantyPeriod = arg.warranty.value;
                                var deliveryPeriod= arg.delivery.value;
                                var autoIds = this.getSelectedItems();
                                this.updateProduct(function(context, result) {
                                }, autoIds, deliveryPeriod, warrantyPeriod);
     
                            }
                        }, [{
                            className: "Terrasoft.Button",
                            caption: "OK",
                            returnCode: "yes"
                        }, "cancel"], this,
                        {
                            warranty: {
                                dataValueType: Terrasoft.DataValueType.INTEGER,
                                caption: "Warranty",
                                customConfig: {
                                    className: "Terrasoft.MemoEdit",
                                    height: "17px"
                                }
                            },
                            delivery: {
                                dataValueType: Terrasoft.DataValueType.INTEGER,
                                caption: "Term",
                                customConfig: {
                                    className: "Terrasoft.MemoEdit",
                                    height: "17px"
                                }
                            }
                        },
                        {
                            defaultButton: 0,
                            style:  {
                                borderStyle: "ts-messagebox-border-style-blue ts-messagebox-border-no-header",
                                buttonStyle: "blue"
                            }
                        }
                    );
                },

    You can see generated Pop-Up in the next Figure.

    Figure 2. Pop-Up using for multiply update.

  6.  Add update function using "Terrasoft.UpdateQuery". We choose a filter of type "OR" to choise selected records. 

updateProduct: function(callback, autoIds, valueWarranty, valueDelivery) {
                        var update = Ext.create("Terrasoft.UpdateQuery", {
                            rootSchemaName: "Product"
                        });
                        var filters = Terrasoft.createFilterGroup();
                        filters.logicalOperation = Terrasoft.LogicalOperatorType.OR;
                        autoIds.forEach(function(item) {
                            var productIdFilter = update.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
                            "Id", item);
                            filters.add("ProductIdFilter" + item, productIdFilter);
                        }, this);
                        update.filters.add(filters);
                        if (valueWarranty) {
                            update.setParameterValue("UsrWaranty", valueWarranty, Terrasoft.DataValueType.TEXT);
                        }
                        if (valueDelivery) {
                            update.setParameterValue("UsrDelivery", valueDelivery, Terrasoft.DataValueType.TEXT);
                        }
                        update.execute(function(result) {
                            callback.call(this, result);
                        }, this);
                    },

 

Like 2

Like

Share

5 comments

Hello, I think isCustomActionEnabled function not working when I click Select All button.

 

Do you have any suggestion? I made some tracing and this function is calling and returning true. but custom action button is not enabled.

 

But if I manually select one/some/all rows it is enabled. Also, when I manually select all rows and then click Select All button, it is somehow setting disabled state.



For test, I returned true always from bind function.

Also, I removed Enable binding and got same result

 

I found one property which is necessary to enable this menu item on select all.

"IsEnabledForSelectedAll": true

Hi Luka,

 

The custom action is not active when using Select All option on purpose. The majority of default actions are not active as well. It is designed to prevent changing all data in the section, for example from deleting data or merging it. That's why majority of actions are greyed out in the drop down list.

 

Regards,

Dean

Hello,

Is callback function not required here?

This not working without it. Please provide the definition for it.

Show all comments

1. Client side

Add next code to your page in methods section:

methods: {
    init: function() {
        this.callParent(arguments);
        Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE, this.onMessageReceived, this);
    },
    onMessageReceived: function(sender, message) {
        if (message && message.Header && message.Header.Sender === "MySenderName") {
            var result = this.Ext.decode(message.Body);
            /// TODO: your code
        }
    },
    destroy: function() {
        this.Terrasoft.ServerChannel.un(Terrasoft.EventName.ON_MESSAGE, this.onMessageReceived, this);
        this.callParent(arguments);
    }
}

2. Server side

Add usings

using Terrasoft.Configuration;
using Terrasoft.Messaging.Common;
using Newtonsoft.Json;

Send message

string senderName = "MySenderName";
// Example for message
string message = JsonConvert.SerializeObject(new {
    RecordId = Guid.NewGuid(), // your record Id
    Name = "Some name"
    // some other parameters
});
 
// For all users
MsgChannelUtilities.PostMessageToAll(senderName, message);
 
// For current user
MsgChannelUtilities.PostMessage(UserConnection, senderName, message);
 
// For specific user with sysAdminUnitId
IMsgChannel channel = MsgChannelManager.Instance.FindItemByUId(sysAdminUnitId);
if (channel != null) {
    var simpleMessage = new SimpleMessage() {
        Id = sysAdminUnitId,
        Body = message,
        Header = {
            Sender = senderName
        }
    };
    channel.PostMessage(simpleMessage);
}

 

Like 4

Like

Share

5 comments

Hi Tatiana. I know this is an old article. Follow up question - 



Can we use the in-built WebSocket to communicate back from the client to the server??

M Shrikanth,

 

Please check the response here 

https://community.creatio.com/questions/send-message-client-server-webs…

 

Best regards,

Oscar

Dear community,

 

Is it possible that a server code called from a pre-configured page is able to send message to client in another section page? Curious to understand how the client is able to recieve the messages from server. What happens if there are 2 section edit pages where the JS code is written? will the message be received in both these pages?

Shivani Lakshman,

Hi Shivani. Here is my understanding. I will let Oscar or Tatiana confirm. 



The Server to Client socket messaging is independent of which section page a user is on. Whichever client side schemas has code to receive those messages, It will be received in all those pages.



The way it works under the hood is that - There is a web socket connection which is established from the Creatio client to the server when a user logs in. This is persistent across all client pages that a user might be in. Any message triggered from the server using the code in this article will flow through that web socket. I also believe that Creatio's inbuilt notifications, Email Sync, telephony related messages are routed to the Client through this socket. 



And by 'server code called from a pre-configured page' - I presume you are referring to (for eg) a script task attached to that business process which has code to trigger the message from server to client. If it is some other way, let me know. 

Shivani Lakshman and M Shrikanth,

 

Yes, M Shrikanth, is correct in the explanation of how a web socket works. If you have two pages that should receive a message from a server, both of them can receive it through a web-socket. 

 

Regards,

Anastasiia

Show all comments

Symptoms

Reproducing the case:

  1. open the section (e.g., [Contacts]);
  2. select the [Show folders] action in the [Filters/folders] menu;
  3. select a dynamic folder in the folder tree;
  4. in the folder setup menu, select the [Set up filter] action;
  5. close the advanced filtering module by clicking the cross icon;
  6. select any record from the section list and start editing it by clicking the [Open] button;
  7. click the [New contact] button;
  8. click [Cancel].

As a result, instead of the [Contacts] section we only see the section caption, the following message is displayed in the console:

1) message: Uncaught TypeError: Cannot read property 'modules' of undefined

2) user: Supervisor/7f3b869f-34f3-4f20-ab4d-7480a5fdf647

file: undefined

line: undefined

message: Cannot read property 'components' of undefined 

date: Mon Nov 16 2015 12:35:00 GMT+0200 (FLE Standard Time)

moduleId: SectionModuleV2_ContactSectionV2_ExtendedFilterEditModule

moduleName: SectionModuleV2

3) message: Uncaught Terrasoft.UnsupportedTypeException: Message GetSectionFiltersInfo is not defined in undefined module 

Cause

The case is reproduced in versions higher han 7.6.0.1500. It is connected with changing the logic of advanced filtering module operation (ExtendedFilterEditModuleV2): it has been inherited from the base schema. It is anyway saved in the browser history and nuder certain circumstances is loaded instead of the expected section module.

Solution

To fix the issue locally on the customer side by replacing the base module, replace the ExtendedFilterEditModuleV2 module having completely copied the code and styles and add the following property before declaring the module methods:

/** * Indicates that the history is used when loading the module. * @public  * @type {Boolean} */
useHistoryState: false,

 

Like 0

Like

Share

2 comments

please explain how to replace this kind of module (ExtendedFilterEditModuleV2)

Hello,



You can do it using the Ext.define() method described in the article by the link below: 

https://academy.creatio.com/docs/developer/front_end_development/module…

 

Best regards,

Bogdan

Show all comments

Symptoms

BPM 7.6.0.838 onSite mobile application does not work

Solution

Most likely you have not updated the database structure.

To update the database structure in the browser, you must:

- Close all instances of Chrome;

- Go to the folder in which Chrome stores local data: C:\Users\[USERNAME]\AppData\Local\Google\Chrome\User Data\Default;

- Delete the contents of the following folders:

C:\Users\[USERNAME]\AppData\Local\Google\Chrome\User Data\Default\File System

C:\Users\[USERNAME]\AppData\Local\Google\Chrome\User Data\Default\databases

- Restart Chrome using startchrome.bat (in the Mobile folder with the source code of the mobile application);

- Run the mobile application in the browser.

As a result, Chrome will create a local database with all the necessary tables from scratch (including new columns).

Additionally, please ensure that the latest Framework is installed on the server.

Like 0

Like

Share

0 comments
Show all comments

Question

How can I get back to the standard Contract page? We have accidentaly created a new type via the section wizard, and all settings got cleared. How can I restore them?

We have also deleted all the replacing schemas connected with the contract while trying to "get back to the previous view" and as a result, we cannot open the edit page. We receive the following error message: "Cannot read property 'entitySchemaName' of undefined".

Answer

Delete the schemas (in your case, you have already done that). Perform registration:

delete from SysModuleEdit
where SysModuleEntityId in (select Id from SysModuleEntity
where SysEntitySchemaUId in (select UId from SysSchema where Name = 'Contract'))
GO
declare @RecordId uniqueidentifier = (select NEWID());
insert into SysModuleEdit(Id, SysModuleEntityId, CardSchemaUId, ActionKindCaption, ActionKindName, PageCaption)
values (@RecordId, '11F1B879-BEC8-4E96-82CC-FB6B77CC854D', '948080FC-031E-4D88-9239-47BCEDAA92BC',
'Добавить договор', 'ContractPage', 'Договор')
insert into SysModuleEditLcz(RecordId, ColumnUId, SysCultureId, Value) values
(@RecordId, 'A19BF4BF-E22B-49B5-B6E0-918FF6290020', '1A778E3F-0A8E-E111-84A3-00155D054C03', 'Добавить договор'),
(@RecordId, '55132174-2B96-4E0A-830C-B8E952B12C45', '1A778E3F-0A8E-E111-84A3-00155D054C03', 'Добавить договор')
update SysModule
set Attribute = ''
where SysModuleEntityId in (select Id from SysModuleEntity
where SysEntitySchemaUId in (select UId from SysSchema where Name = 'Contract'))
GO

Restore the edit pages for all custom contract types via the section wizard with specifying their parent in the schemas:Edit page schema of the "Contracts" section.

Like 0

Like

Share

0 comments
Show all comments

Question

How can I get into the local database of a mobile application emulator?

For example, to see what data is exchanged during offline synchronization.

Answer

Physically, the file is here - ... \7.11.7\ChromeUserData\Default\databases\file__0, but you will not be able to open it with custom tools due to encryption. 

There are two options:

Open the console in the browser (after synchrobnization), go to the "Application" tab, expand the list of databases in Web SQL and select the bpm'online database. As a result, you'll be able to write SQL queries and see a list of all tables.

More information can be found in a separate article - https://developers.google.com/web/tools/chrome-devtools/manage-data/loc…

- find an extension for Firefox that can work with SQLlite (you can find it on third-party resources).

Like 0

Like

Share

0 comments
Show all comments

Symptoms

After I have upgraded to version 7.7.0, I get an error when receiving  the number of notifications via execution of the GetUserNotificationCount method (the RemindingsDataService service). The error message is as follows: "Cannot create an instance of Terrasoft.Configuration.BaseNotificationProvider because it is an abstract class."

Cause

The Terrasoft.Configuration.BaseNotificationProvider class name is changed for Terrasoft.Configuration.SystemNotificationProvider in the NotificationProvider table of version 7.7.0. When updating, the modification must be applied via the data setting, but this data is not set in the customer configuration for some reason.

Solution

Perform the following script on the customer base:

UPDATE [NotificationProvider]
SET
[ClassName] = 'Terrasoft.Configuration.SystemNotificationProvider',
[Type] = 2
WHERE [ClassName] = 'Terrasoft.Configuration.BaseNotificationProvider'

Necessary conditions and possible restrictions

If there is no access to the base, perform this script via the configuration.

Like 0

Like

Share

0 comments
Show all comments

This article explains how to bind two different printables together and use one click to print.

Case description:

For example, the first part of the printable should be generated as a word file and the second  printable should be generated as a PDF file. It contains information from the opportunity, which the users are not allowed to change it.

Algorithm of realization:

  1.  We need to bind two printing forms. You should create an object that will contain links to the root printable form, and additional printable.

  2. You should to create and configure two printables or use existing. You should create a lookup for printables binding and bind two printables, which will be printed together.



     
  3. You should create client replacing module for "OpportunityPageV2" and "OpportunitySectionV2" from NUI package 
  4. Insert following code in OportunityPageV2 and OpportunitySectionV2 

    define("OpportunitySectionV2", [], function() {
        return {
            entitySchemaName: "Opportunity",
            methods: {
                generatePrintForm: function(printForm) {
                    this.callParent(arguments);
                    this.generateAdditionalReports(printForm.getTemplateId(), this.getPrintRecordId() || Terrasoft.GUID_EMPTY);
                },
                getAdditionalReportsESQ: function(mainReportId) {
                    var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                        rootSchemaName: "GlbAdditionalReport"
                    });
                    esq.addColumn("GlbAdditReport.Id", "AdditionalReportId");
                    esq.addColumn("GlbAdditReport.ConvertInPDF", "CToPdf");
                    esq.filters.add("OpportunityFilter", this.Terrasoft.createColumnFilterWithParameter(
                        this.Terrasoft.ComparisonType.EQUAL, "GlbMainReport", mainReportId));
     
                    return esq;
                },
                generateAdditionalReports: function(rootReportId, recordId) {
                    this.showBodyMask();
                    var esq = this.getAdditionalReportsESQ(rootReportId);
                    esq.getEntityCollection(function(result) {
                        if (result.success && result.collection.getCount() > 0) {
                            result.collection.each(function(item) {
                                var data = {
                                    templateId: item.get("AdditionalReportId"),
                                    convertInPDF: item.get("ConvertInPDF"),
                                    recordId: recordId || Terrasoft.GUID_EMPTY
                                };
     
                                var serviceConfig = {
                                    serviceName: "ReportService",
                                    methodName: "CreateReport",
                                    data: data,
                                    timeout: 20 * 60 * 1000
                                };
                                var callback = function(response) {
                                    var key = response.CreateReportResult;
                                    this.downloadReport(item.get("AdditionalReportId"), key);
                                };
                                this.callService(serviceConfig, function(response) {
                                    callback.call(this, response);
                                }, this);
                            }, this);
                        } else {
                            return;
                        }
                    }, this);
                    this.hideBodyMask();
                }
            }
        };
    });



    !!! IMPORTANT. You should allow multiply download files in your browser.

Like 0

Like

Share

4 comments

Does it works?

Dear,

 

The provided code works properly. Please don’t forget to replace the “&&” symbols with “&&” symbols and the “>” symbols with the “>” symbol.

 

Best regards,

Norton

Would it be possible to merge these reports into one big report? instead of multiple downloads?

Gary Singh,

Unfortunately, no. Since the document's structure has to be changed and absolutely new macros created, there is no known way of the printable's auto-creating.

In the described method, we configure two printables, which were manually created with their own connections between macro tags and columns. 

Show all comments

To lock all elements on the page you need to install package GlbPageReadOnlyMode and set up page.

  1. Initialize readOnly mode:

    init: function() {
        this.subscribeReadOnlyEvent({
            excludedDetails: [/*Here add details you want to exclude*/],
            excludedModules: [/*Here add modules you want to exclude*/],
            excludedItems: [/*Here add fields you want to exclude*/]
        });
        this.callParent(arguments);
    }

     

  2. Set up condition to lock a page:

    changeReadOnlyMode: function() {
        if (this.get("Contact")) { // If "Contact" field is filled in, then the page is locked
            this.setPageReadOnlyMode(this, true);
        } else {
            this.setPageReadOnlyMode(this, false);
        }
    }

     

Example: lock page "ContactPageV2" when "Account" field is filled in:

ContactPageV2

define("ContactPageV2", [], function() {
    return {
        entitySchemaName: "Contact",
        methods: {
            init: function() {
                this.subscribeReadOnlyEvent();
                this.callParent(arguments);
            },
            changeReadOnlyMode: function() {
                if (this.get("Account")) {
                    this.setPageReadOnlyMode(this, true);
                } else {
                    this.setPageReadOnlyMode(this, false);
                }
            }
        }
    };
});

 

Like 0

Like

Share

0 comments
Show all comments