Symptoms

Bug report:

Type: Terrasoft.SourceCodeException

Message: TypeError: undefined is not an object (evaluating 'ruleConfig.rule')

Cause

BusinesRuleManager in the edit card executes the rules at the same time, in parallel.

Solution

1. In Configuration, add a custom schema with the “Source code”  type, e.g., with the “UsrMobileUtilities” name;

2. Paste the following code in the schema:

Ext.define("Terrasoft.BusinessRulesManager.Override", {
    override: "Terrasoft.BusinessRulesManager",
    /** * @private */
    doExecuteRules: function(config) {
        this.executionConfig = config;
        this.allRulesAreValid = true;
        this.executeRulesForNextRecord();
    },
    executeRules: function(config) {
        if (this.rulesToExecute > this.rulesExecuted) {
            this.waitRulesInProgressId = setInterval(function() {
                if (this.rulesToExecute === this.rulesExecuted) {
                    clearInterval(this.waitRulesInProgressId);
                    this.doExecuteRules(config);
                }
            }.bind(this), 500);
        } else {
            this.doExecuteRules(config);
        }
    }
});

3. Save changes.

4. Connect this schema in the mobile application manifest (for example, “MobileApplicationManifestDefaultWorkplace”) in the “CustomSchemas” section:

"CustomSchemas": [
    "UsrMobileUtilities"
]

5. Save changes.

Alternative solution: fill out the City, Regions and Countries lookups (connected fields must also be populated).

Like 0

Like

Share

0 comments
Show all comments

Question

What are the features of the camera API in the mobile application? (v 5.4)

Answer

BPMonlineMobile 5.4 uses PhoneGap 2.8.

You can read about the camera features here: http://cordova.apache.org/docs/en/2.8.0/cordova_camera_camera.md.html#C…

Like 0

Like

Share

0 comments
Show all comments

Question

How can I get a link to a picture added in the Images module section?

Answer

To receive the link to an image added into a module:

1. Add a dependency for the Terrasoft  library into define

2. Receive the picture config:

var imageConfig = resources.localizableImages.ImageListSchemaItem1;

The image name will be different.

3. Convert the config into a link:

var link = Terrasoft.ImageUrlBuilder.getUrl(imageConfig);

 

Like 0

Like

Share

0 comments
Show all comments

Question

I cannot perform search by opportunities if I do not know what the case of the opportunity name is.

Answer

In the base version, the filters by text fields do not depend on the case. Try adding "%" in front of the value that you specify in the search field - the opportunity name might be slightly different from it.

Like 0

Like

Share

0 comments
Show all comments

Prerequisites

The object must have displayed value.

1. Run script in dev environment to create [glb_RegisterSection] stored procedure

glb_RegisterSection stored procedure

CREATE OR ALTER PROC [glb_RegisterSection] (
  @EntityName       NVARCHAR(100),
  @SectionCaption   NVARCHAR(100),
  @SectionPageName  NVARCHAR(100),
  @EditPageName     NVARCHAR(100)
)
AS BEGIN TRANSACTION;
   SET NOCOUNT ON;
   SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
   SET XACT_ABORT ON;
BEGIN TRY
IF @EntityName = ''
    THROW 50001, 'Parameter @EntityName is empty', 1;
IF @SectionCaption = ''
    THROW 50001, 'Parameter @SectionCaption is empty', 1;
DECLARE @SysModuleId        UNIQUEIDENTIFIER = NEWID();
DECLARE @SysModuleEditId    UNIQUEIDENTIFIER = NEWID();
DECLARE @SysModuleEntityId  UNIQUEIDENTIFIER = NEWID();
DECLARE @SysEntitySchemaUId UNIQUEIDENTIFIER;
DECLARE @SectionSchemaUId   UNIQUEIDENTIFIER;
DECLARE @CardSchemaUId      UNIQUEIDENTIFIER;
DECLARE @ActionKindName     NVARCHAR(250);
DECLARE @PageCaption        NVARCHAR(250);
SELECT TOP 1
    @SysEntitySchemaUId = UId,
    @ActionKindName = Caption
FROM SysSchema
WHERE Name = @EntityName
    AND ExtendParent = 0;
SELECT TOP 1
    @SectionSchemaUId = UId
FROM SysSchema
WHERE Name = @SectionPageName
    AND ExtendParent = 0;
SELECT TOP 1
    @CardSchemaUId = UId,
    @PageCaption = Caption
FROM SysSchema
WHERE Name = @EditPageName
    AND ExtendParent = 0;
IF @SysEntitySchemaUId IS NULL
    THROW 50002, 'Entity not found. Check @EntityName input parameter.', 1;
IF @SectionSchemaUId IS NULL
    THROW 50002, 'Section page not found. Check @SectionPageName input parameter.', 1;
IF @CardSchemaUId IS NULL
    THROW 50002, 'Edit page not found. Check @EditPageName input parameter.', 1;
INSERT INTO SysModuleEntity (
    Id,
    SysEntitySchemaUId)
VALUES (
    @SysModuleEntityId,
    @SysEntitySchemaUId
);
INSERT INTO SysModuleEdit (
    Id,
    SysModuleEntityId,
    CardSchemaUId,
    UseModuleDetails,
    ActionKindCaption,
    ActionKindName,
    PageCaption)
VALUES (
    @SysModuleEditId,
    @SysModuleEntityId,
    @CardSchemaUId,
    1,
    'New',
    @ActionKindName,
    @PageCaption
);
INSERT INTO SysModule (
    Id,
    Caption,
    Code,
    SectionSchemaUId,
    SysModuleEntityId,
    CardSchemaUId,
    FolderModeId,
    SectionModuleSchemaUId,
    CardModuleUId,
    Image32Id)
VALUES (
    @SysModuleId,
    @SectionCaption,
    @EntityName,
    @SectionSchemaUId,
    @SysModuleEntityId,
    @CardSchemaUId,
    'B659D704-3955-E011-981F-00155D043204',
    'DF58589E-26A6-44D1-B8D4-EDF1734D02B4',
    '4E1670DC-10DB-4217-929A-669F906E5D75',
    '026742D9-390C-4778-BC46-9FA85C42677A'
);
SELECT
    @SysModuleId AS SysModule,
    @SysModuleEntityId AS SysModuleEntity,
    @SysModuleEditId AS SysModuleEdit;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
SELECT ERROR_NUMBER() AS ErrorNumber,
       ERROR_MESSAGE() AS ErrorMessage;
IF @@TRANCOUNT > 0
    ROLLBACK TRANSACTION;
END CATCH;
IF @@TRANCOUNT > 0
    ROLLBACK TRANSACTION;

2. Create section and edit pages (if not exist)

 

Create Section page (parent BaseSectionV2)

define("UsrEntitySectionV2", [], function() {
    return {
        entitySchemaName: "UsrEntity",
        messages: {},
        mixins: {},
        attributes: {},
        methods: {},
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
    };
});

Create Edit page (parent BaseModulePageV2)

define("UsrEntityPageV2", [], function() {
    return {
        entitySchemaName: "UsrEntity",
        messages: {},
        mixins: {},
        attributes: {},
        methods: {},
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
    };
});

 

3. Execute a stored procedure in dev environment to register section.

Stored procedure [glb_RegisterSection] takes such arguments: EntityName, SectionCaption, SectionPageName, EditPageName.

Example

exec dbo.[glb_RegisterSection] 'UsrEntity', 'My entities', 'UsrEntitySectionV2', 'UsrEntityPageV2'



4. Bind new data to a package with a filter by IDs from output for the following system tables:

  • SysModuleEntity
  • SysModule
  • SysModuleEdit

Standard list of objects

EntityName, EntityName + "Folder", EntityName + "File", EntityName + "InFolder", EntityName + "Tag", EntityName + "InTag"

Like 0

Like

Share

9 comments

Can I use this approach to create new section for the "Relationship" object or "ContactCareer" object of BPM that came out of the box? If so, are there any extra steps I need to take?

 

kumar,

You can use this instruction to create a new section for the object.

Some details: 

When you create edit page and section page you should choose that options instead of module http://prntscr.com/mb5d9o



Also, it`s necessary to create a backup of the database before adding the section because it`s pretty difficult operation that can cause issues.



Please note, that created section and edit page should not contain the prefix because objects that you specified are system ones. You can simply temporarily remove it from the system setting "Prefix for object name".



And also it necessary to clear redis, relogin and compile the system after section was added.



Best regards,

Alex

Alex_Tim,

Do you know if it is possible to also add section folders when using this method? I've used the above to cover an object created as a detail to a full section, but not sure how to add & relate the EntityFolder and EntityInFolder objects so I can create folders in the section. Is this possible?

Thanks,

Ryan

For anyone else that comes across this, to add folders, all you need to do is add a new object named EntityName + "Folder" that inherits from BaseFolder as well as Entity + "InFolder" that inherits from BaseItemInFolder (and also add a lookup property to your custom entity as well as change the lookup for the virtual Folder property of the inherited properties). The code above already specifies the correct FolderModeId so once you add the object, log out and back in again, then you'll have folders for the entity.

Hello,

There is a failed case in this script. When an object has already been added in a Detail, it will duplicate SysModuleEntity, and the new edit page won't be used. System always uses the first page created. Therefore the detail edit page and the section edit page will always be the same. I updated the script a little bit to check if the SysModuleEntity and SysModuleEdit are created. 

 

CREATE OR ALTER PROC [glb_RegisterSection] (
	@EntityName       NVARCHAR(100),
	@SectionCaption   NVARCHAR(100),
	@SectionPageName  NVARCHAR(100),
	@EditPageName     NVARCHAR(100)
)
AS BEGIN TRANSACTION;
	SET NOCOUNT ON;
	SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
	SET XACT_ABORT ON;
BEGIN TRY
IF @EntityName = ''
	THROW 50001, 'Parameter @EntityName is empty', 1;
IF @SectionCaption = ''
	THROW 50001, 'Parameter @SectionCaption is empty', 1;
DECLARE @SysModuleId        UNIQUEIDENTIFIER = NEWID();
DECLARE @SysModuleEditId    UNIQUEIDENTIFIER;
DECLARE @SysModuleEntityId  UNIQUEIDENTIFIER;
DECLARE @SysEntitySchemaUId UNIQUEIDENTIFIER;
DECLARE @SectionSchemaUId   UNIQUEIDENTIFIER;
DECLARE @CardSchemaUId      UNIQUEIDENTIFIER;
DECLARE @ActionKindName     NVARCHAR(250);
DECLARE @PageCaption        NVARCHAR(250);
SELECT TOP 1
	@SysEntitySchemaUId = UId,
	@ActionKindName = Caption
FROM SysSchema
WHERE Name = @EntityName
	AND ExtendParent = 0;
SELECT TOP 1
	@SectionSchemaUId = UId
FROM SysSchema
WHERE Name = @SectionPageName
	AND ExtendParent = 0;
SELECT TOP 1
	@CardSchemaUId = UId,
	@PageCaption = Caption
FROM SysSchema
WHERE Name = @EditPageName
	AND ExtendParent = 0;
IF @SysEntitySchemaUId IS NULL
	THROW 50002, 'Entity not found. Check @EntityName input parameter.', 1;
IF @SectionSchemaUId IS NULL
	THROW 50002, 'Section page not found. Check @SectionPageName input parameter.', 1;
IF @CardSchemaUId IS NULL
	THROW 50002, 'Edit page not found. Check @EditPageName input parameter.', 1;
 
Select TOP 1
	@SysModuleEntityId = Id
From SysModuleEntity
Where SysEntitySchemaUId = @SysEntitySchemaUId
 
if (@SysModuleEntityId IS NULL)
BEGIN
	SELECT @SysModuleEntityId = NEWID()
	INSERT INTO SysModuleEntity (
		Id,
		SysEntitySchemaUId)
	VALUES (
		@SysModuleEntityId,
		@SysEntitySchemaUId
	);
END
 
Select TOP 1
	@SysModuleEditId = Id
From SysModuleEdit
Where SysModuleEntityId = @SysModuleEntityId
 
IF @SysModuleEditId IS NULL
BEGIN
	SELECT @SysModuleEditId = NEWID()
	INSERT INTO SysModuleEdit (
		Id,
		SysModuleEntityId,
		CardSchemaUId,
		UseModuleDetails,
		ActionKindCaption,
		ActionKindName,
		PageCaption)
	VALUES (
		@SysModuleEditId,
		@SysModuleEntityId,
		@CardSchemaUId,
		1,
		'New',
		@ActionKindName,
		@PageCaption
	);
END
INSERT INTO SysModule (
	Id,
	Caption,
	Code,
	SectionSchemaUId,
	SysModuleEntityId,
	CardSchemaUId,
	FolderModeId,
	SectionModuleSchemaUId,
	CardModuleUId,
	Image32Id)
VALUES (
	@SysModuleId,
	@SectionCaption,
	@EntityName,
	@SectionSchemaUId,
	@SysModuleEntityId,
	@CardSchemaUId,
	-- 'B659D704-3955-E011-981F-00155D043204', -- Use multiple folder
	'A24A734D-3955-E011-981F-00155D043204', -- Do not use folder
	'DF58589E-26A6-44D1-B8D4-EDF1734D02B4',
	'4E1670DC-10DB-4217-929A-669F906E5D75',
	'026742D9-390C-4778-BC46-9FA85C42677A'
);
SELECT
	@SysModuleId AS SysModule,
	@SysModuleEntityId AS SysModuleEntity,
	@SysModuleEditId AS SysModuleEdit;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
SELECT ERROR_NUMBER() AS ErrorNumber,
		ERROR_MESSAGE() AS ErrorMessage;
IF @@TRANCOUNT > 0
	ROLLBACK TRANSACTION;
END CATCH;
IF @@TRANCOUNT > 0
	ROLLBACK TRANSACTION;



 

Hi, 

I followed the above steps . But there was no section created in any any of the workspace. Kindly suggest how to create new menu /section for the existing object.

Sriraksha KS,

Firstly, we highly do not recommend to create several sections per one object. Please note, that data will be duplicated in both sections, since they are referring to one object. You can create a new object in the system with the same range of columns and copy data from initial object to newly created. 

Nevertheless, if you intend to add section manually, please take a look at following tables: 

SysModule,

SysModuleEdit,

SysModuleEntity, 

SysModuleInWorkplace, 

SysSchema

 

Regards,

Anastasia

Does this still work for Freedom UI? Or is a new process required for achieving the same result now?

Harvey Adcock,

 

No, for Freedom UI sections, use the Freedom UI designer, which allows creation of sections for existing objects.

Show all comments

Case

A customer cannot log in to bpm'online (The element with ""  identifier not found)

Solution

First of all, try clearing Redis, compiling the application and updating the website page.

If the indicated actions do not help, execute the "Configuration check" and determine what section contains the error.

Republish the objects of the detected section (sections) and recompile.

Like 0

Like

Share

0 comments
Show all comments

Question

Kindly advise how I can put "Ukraine" at the top of the list in the [Countries] lookup (not a drop-down list).

Answer

Create a "Country" replacing object and add a UsrSort (Priority) integer column with the "0" default value therein.

Add and execute an SQL script in the configuration, which will arrange the priority as you need it - Ukraine will come first and all the rest of the countries will be arranged in the alphabetical order:

Script text:

UPDATE Country SET UsrSort = 0 WHERE Name = 'Ukraine'
 
DECLARE @sort INT
DECLARE @id uniqueidentifier
DECLARE @getid CURSOR
 
SET @sort = 1
SET @getid = CURSOR FOR
SELECT Country.Id FROM Country
WHERE Name Not In ('Ukraine')
ORDER BY Name
 
OPEN @getid
FETCH NEXT
FROM @getid INTO @id
WHILE @@FETCH_STATUS = 0
BEGIN
    UPDATE Country SET UsrSort = @sort WHERE Id = @id
    SET @sort = @sort + 1
    FETCH NEXT
    FROM @getid INTO @id
END
 
CLOSE @getid
DEALLOCATE @getid

You can later on display this column in the record list via the "View" - "Select fields to display" and use it for sotring via "View"- "Sort by".

Like 0

Like

Share

0 comments
Show all comments

Question

We are trying to optimize the synchronization time of the mobile application (offline), and one of the steps is image optimization.

How can we set the target image size (for example 1280 x 800)?

For example, there is a feature in Appache Cordova for this exact scenario.

Is it possible to do this in the settings or is it necessary to change the code?

Answer

We already optimaze images in the app.

Below is the code used in the base version:

Terrasoft.Camera.captureFromCamera({
            quality: 70,//в процентах
            size: 1280,//по максимальной стороне
            success: function() {},
            failure: function() {},
            scope: this
        });

This code enables you to change the image size:

Terrasoft.sdk.RecordPage.configureColumn("Opportunity", "opportunityFilesDetail", "Data", {
    quality: 50
});

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

We do not have employee birthdays displayed in the communication panel. I have set a bithday date for an employee and changed the notification period in the corresponding system setting today, however, no notifications are visible in the communication panel.

Cause

The [Current employment] detail is not populated.

Solution

The noteworthy event notifications can only be received if the [Current employment] detail is populated.

Like 0

Like

Share

0 comments
Show all comments

This article explains how to perform bulk data export/import between SQL Server databases.

This process should be performed in NOT business hours.

TABLE EXPORT

1. Create directories

C:\Export

C:\Export\Data\

C:\Export\Data\Error\

C:\Export\Data\Log\

2. In the script bellow specify the correct db name instead of /SourceDBName/ and source server name instead of /ServerName/. In this example bcp utility connects to SQL Server with a trusted connection using integrated security.

Export entire table:
bcp SourceDBName.dbo.SourceTableName OUT C:\Export\Data\SourceTableName.bcp -m 1 -n -e C:\Export\Data\Error\Error_out.log -o C:\Export\Data\Log\Output_out.log -S[ServerName] -T
 
Export data from select statement(data file + format file):
--Export data
bcp "SELECT Name FROM SourceDBName.dbo.SourceTableName" queryout SourceTableName.dat -c -T -S[ServerName]
--Export format file
bcp SourceDBName.dbo.SourceTableName format nul -x -f SourceTableName.xml -T -Sint-ms\mssql2016 -c

3. Run CMD as Administrator and execute the script from step 2

bcp will create the following 

SourceTableName.bcp data file (C:\Export\Data\SourceTableName.bcp)

Error_out.log (C:\Export\Data\Error\Error_out.log)

Output_out.log (C:\Export\Data\Log\Output_out.log)

Review Error_out.log and Output_out.log.

Error_out.log should be blank.

 

DATA IMPORT

1. Create temporary table

SELECT * INTO Data_IMPORT
FROM TargetTableName
WHERE 1 = 2;

2. Run cmd. with the following script and specify the correct db name insted of TargetDName and server name instead of ServerName

1. Import entire table with bcp IN

bcp TargetTable IN C:\Export\Data\SourceTableName.bcp -b 5000 -h "TABLOCK" -m 1 -n -e C:\Export\Data\Error\Error_in.log -o C:\Export\Data\Log\Output_in.log -S[ServerName] -T -q

2. Import data from data file with INSERT INTO ... FROM OPENROWSET(BULK

INSERT INTO dbo.TargetTable
SELECT *
FROM OPENROWSET(BULK 'D:\Data\SourceTableName.txt',
    FORMATFILE = 'D:\Data\SourceTableName.xml') as t1;

Wait until the operation is done. It can take up to few hours depending on the amount of data you are exporting.

You can look through Output_out.log to understand the export status.

3. Insert into destination table

CREATE NONCLUSTERED INDEX IX_SourceImportTableName_Id
    ON SourceImportTableName(Id);
GO
 
SET NOCOUNT ON;
DECLARE @BatchSize INT = 1000;
DECLARE @I INT = 0;
--Calculate number of iterations
DECLARE @TotalCount INT = (SELECT COUNT(*) / @BatchSize
    FROM SourceImportTableName imp WITH(NOLOCK)
    WHERE NOT EXISTS(
       SELECT Id
       FROM TargetTableName l WITH(NOLOCK)
       WHERE l.Id = imp.Id));
WHILE (@I < @TotalCount)
BEGIN
INSERT INTO Lead WITH(TABLOCK)
SELECT TOP(@BatchSize) *
FROM SourceImportTableName imp
WHERE NOT EXISTS(
    SELECT Id
    FROM TargetTableName l
    WHERE l.Id = imp.Id)
SET @I = @I + 1;
END;

Here are example scripts to import Lead table on server int-ms\mssql2016

--Export
bcp SourceDBName.dbo.Lead OUT C:\Export\Data\Lead.bcp -m 1 -n -e C:\Export\Data\Error\Error_out.log -o C:\Export\Data\Log\Output_out.log -Sint-ms\mssql2016 -T
 
--Import
bcp TargetDBName.dbo.Lead IN C:\Export\Data\Lead.bcp -b 5000 -h "TABLOCK" -m 1 -n -e C:\Export\Data\Error\Error_in.log -o C:\Export\Data\Log\Output_in.log -Sint-ms\mssql2016 -T -q
 
--Insert data into destination table
USE TargetDBName;
CREATE NONCLUSTERED INDEX IX_Lead_Id
    ON Lead_IMPORT(Id);
GO
 
SET NOCOUNT ON;
DECLARE @BatchSize INT = 1000;
DECLARE @I INT = 0;
--Calculate number of iterations
DECLARE @TotalCount INT = (SELECT COUNT(*) / @BatchSize
    FROM Lead_IMPORT imp WITH(NOLOCK)
    WHERE NOT EXISTS(
       SELECT Id
       FROM Lead l WITH(NOLOCK)
       WHERE l.Id = imp.Id));
WHILE (@I < @TotalCount)
BEGIN
INSERT INTO Lead WITH(TABLOCK)
SELECT TOP(@BatchSize) *
FROM Lead_IMPORT imp
WHERE NOT EXISTS(
    SELECT Id
    FROM Lead l
    WHERE l.Id = imp.Id)
SET @I = @I + 1;
END;

Example: Import part of the bcp data file

--Export
bcp Azull_D_1.dbo.Account OUT C:\Export\Data\Account.bcp -m 1 -n -e C:\Export\Data\Error\Error_out.log -o C:\Export\Data\Log\Output_out.log -Sint-ms\mssql2016 -T
--Format file
bcp Azull_D_1.dbo.Account format nul -x -f Account.xml -T -Sint-ms\mssql2016 -m 1 -n
--Load data
INSERT INTO dbo.Account
SELECT *
FROM OPENROWSET(BULK 'D:\Data\Account.bcp',
    FORMATFILE = 'D:\Data\Account.xml') as t1
WHERE Createdon > '2017-08-01 00:00:00';

Example: Export/Import some Accounts from select statement

bcp "SELECT * FROM Azull_D_1.dbo.Account WHERE ModifiedOn > '2017-08-01 00:00:00'" queryout Account.txt -T -Sint-ms\mssql2016 -c
bcp Azull_D_1.dbo.Account format nul -x -f Account.xml -T -Sint-ms\mssql2016 -c
 
INSERT INTO dbo.Account
SELECT *
FROM OPENROWSET(BULK 'D:\Data\Account.txt',
    FORMATFILE = 'D:\Data\Account.xml') as t1;

Here is a link to full bcp utility documentation https://docs.microsoft.com/en-us/sql/tools/bcp-utility.

https://docs.microsoft.com/en-us/sql/relational-databases/import-export/create-a-format-file-sql-server

Like 0

Like

Share

0 comments
Show all comments