I'm optimising a query attempting to use a filter with 'Terrasoft.ComparisonType.EXISTS', I'm guessing at the syntax and it isn't working.  If anyone could point out where I'm going wrong here:

...
const subFilter = Terrasoft.createFilterGroup();
subFilter.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrRefundItem", true));
const esqSecondFilter = Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EXISTS, subFilter);
esq.filters.add("esqSecondFilter", esqSecondFilter);
...

Thanks,

 

Like 0

Like

8 comments

Hello Gareth,

 

Terrasoft.ComparisonType.EXISTS is not used in the client-side system logic anymore since it was replaced with the createExistsFilter function. So you need to use it instead of EXISTS comparison type.

 

Best regards,

Oscar

Oscar Dylan,

I have tried the following but it is returning more than one record:

const caseId = this.get("MasterRecordId");
const esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
	rootSchemaName: "UsrItemInOrder"
});
esq.addAggregationSchemaColumn("Id", Terrasoft.AggregationType.COUNT, "RefundCount", Terrasoft.AggregationEvalType.ALL);
const esqFirstFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrCase", caseId);
esq.filters.addItem(esqFirstFilter);
var subFilter = Terrasoft.createFilterGroup();
subFilter.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrRefundItem", true));
const esqSecondFilter = Terrasoft.createExistsFilter("Id", subFilter);
...

I am not filtering with a subquery here, just on the one table.

Gareth Osler,

Hi Gareth. Here is a sample of how to get a count (this gets a count of all accounts with a type of "Customer", however, to just get a count of the entire table you'd just omit the filter):

var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "Account"
});
esq.addAggregationSchemaColumn("Id", Terrasoft.AggregationType.COUNT, "AccountCount");
esq.filters.add(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Type.Name", "Customer"));
esq.getEntityCollection(function(result) {
    console.log("Total customers", result.collection.first().get("AccountCount"));
});

With an exists sub-filter like in your code, it would look like this:

// get a count of all accounts with a "UsrClientSystem" record that has a system type of "Creatio"
var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "Account"
});
esq.addAggregationSchemaColumn("Id", Terrasoft.AggregationType.COUNT, "AccountCount");
 
var subFilter = Terrasoft.createFilterGroup();
subFilter.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrSystemType.Name", "Creatio"));
esq.filters.addItem(Terrasoft.createExistsFilter("[UsrClientSystem:UsrAccount].Id", subFilter));
 
esq.getEntityCollection(function(result) {
    console.log("Total accounts with Creatio system", result.collection.first().get("AccountCount"));
}, this);

Ryan

Ryan Farley, Thank you for the reply.  I am querying with an exists filter on the same table as the esq query, the esq query is on table UsrItemInOerder, for an exist filter of there exists a record with a UsrRefundItem column value of true.  What would the column path be for a createExistsFilter() call in that situation?

Gareth Osler,

I'm not 100% sure I follow. So you want to know if there's a UsrItemInOrder record for the parent Order that has a value of true for the UsrRefundItem column? If that's the case, you can just simplify the query (no need for the exists sub filter):

var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "UsrItemInOrder"
});
// get a count of items with a refund
esq.addAggregationSchemaColumn("Id", Terrasoft.AggregationType.COUNT, "RefundCount");
// for all UsrItemInOrder rows for the parent Order
esq.filters.add(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Order", this.get("MasterRecordId"));
// add filter for refund items only
esq.filters.add(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrRefundItem", true);
// get result, this will return 1 row with a count of refund items in RefundCount column
esq.getEntityCollection(function(result) {
    var hasRefunds = (result.collection.first().get("RefundCount") > 0);
});

Ryan

Ryan Farley,

That is essentially what I have done.  But could that query be optimized with an exists query, it is being run on a database with circa 1.5 million records.

 

Gareth Osler,

What I was trying to do is illustrated in SQL terms in this stackexchange question,

SELECT TOP (1) id 
  FROM dbo.table
  WHERE price IS NULL
    AND category = 'hardware';

which I am arriving at the conclusion is not possible with a Creatio ESQ query.  The solution counting the records matching the case Id and 'UsrRefundItem'

flag true conditions is probably the fastest otherwise.

Gareth Osler,

The only way to do a "top" or "limit" that I know of via ESQ is like this:

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
	rootSchemaName: "UsrEntity"
});
// get only first row in results
esq.rowCount = 1;
esq.addColumn("Id");
// add any filters
esq.getEntityCollection(function(response) {
	// only one row returned
}, this);

To be honest, I've never ran profiler to see if rowCount=X actually does translate to TOP X or LIMIT X, but I assume it does. However, I think the previous method of getting the count would be a more efficient way. The ESQ I posted earlier is the equivalent of:

select count(Id) as RefundCount from UsrItemInOrder where OrderId = 'SOMEID' and UsrRefundItem = 1

Ryan

Show all comments

What is the easiest way to call a method defined in the client module source code of one detail from the client module source code of another detail?  The details are in different tabs.

Like 0

Like

1 comments

You can do this using the sandbox. See https://academy.creatio.com/docs/developer/front_end_development/sandbo…

Basically, if detail1 needs to call a function defined in detail2, in detail1 you'd define a message with mode PTP and direction PUBLISH. In detail2, you'd define the same message with mode PTP and direction SUBSCRIBE. Detail1 would publish the message via the sandbox when it wants to invoke the function in the other detail. Then in detail2, when the message is received, it would execute the function. 

Hope this helps get you started. Here's a sample from an older post of sending messages between details: https://community.creatio.com/articles/implementing-messages-sandbox-de…

Ryan

Show all comments

I am developing an application using a Creatio trial (before implementing on the development server).  I have saved the application as a package, and have imported back into another Creatio trial.  Everything works fine.

 

The problem I have is I am not able to edit the JavaScript I have developed in the package's replacing client modules.  When I view the client module from the Configuration page, I can see the JavaScript that I have developed, but when I try to edit the JavaScript from the section wizard, there is only a 'define' function with empty sections, not the JavaScript that I developed.

 

Is it possible to continue developing client module JavaScript from one trial of Creatio to another?

 

Thanks in advance,

Like 0

Like

1 comments

Dear Gareth, 



The logic behind this behavior is that when any changes comes in the package they should not be directly changed since packages can be distributed by third-party publishers. 

Only way to change functionality installed is to re-define the code or add new methods within the new replacing module in your custom packages. 



Kind regards,

Roman

 

Show all comments

Hi team,

in portal section page is missing the switch advanced mode feature,

how can I enable it ?

 

Like 0

Like

2 comments

Hello Stefano,

 

Basic functionality doesn't include the ability to apply filter conditions based on the connected objects  for the portal user directly in the section, therefore the advanced filter option is not available for such user there.

As a workaround you may use a dynamic folder and set the needed filter conditions for it. 

Also, we already have a query registered for our responsible R&D team to implement this functionality for portal users in the upcoming versions of the application. I will assign your case to this project in order to increase its priority.

Thank you!

Best regards,

Anastasiia

Anastasiia Zhuravel,

thank you Anastasiia

Show all comments

Is it possible to disable or remove the comment button/icon on Agent Desktop feed posts or prevent comments using permissions or a system setting?

Like 0

Like

6 comments

Hello Gareth,

 

Could you please elaborate on the task you are trying to achieve?

Additionally, could you please provide screenshots of the section you want to change?

 

Thank you,

Artem.

Artem,

 

The task I have been asked to do is to prevent users from adding comments to posts on the feed of the Agent Desktop.  Is it possible to remove or disable the comment button (see image)?  Thanks,

 

Gareth Osler,

One quick and easy way is to just hide the comments button with CSS. Add css to the agent desktop page - See https://customerfx.com/article/adding-custom-css-style-sheets-in-bpmonl…

Then add this CSS to hide the comments button:

#OperatorSingleWindowPageContainer [data-item-marker="SocialFeedContainer"] [data-item-marker="Comments"] {
    display: none;
}

Ryan

OperatorSingleWindowPage Agent desktop page already has CSS defined, namely OperatorSingleWindowCSS Agent desktop: CSS styles, which cannot be edited.

 

So I created another CSS file UsrOperatorSingleWindowCSS2 and put the CSS to hide comments in it.

 

The Agent desktop page isn't a normal section, it's not possible to open the section wizard, so I created a Replacing view model as follows:

Unsurprisingly the above did not work!  

 

Any suggestions would be appreciated.

 

Thanks,

Gareth Osler,

It does not appear as though you've created the replacing client view correctly. The code you shared shows "UsrClientUnit_fdb86f8", not "OperatorSingleWindowPage". This needs to change to match the view model being replaced. 

Ryan

Thanks for pointing out the mistake (you shouldn't have had to!).

 

For reference of anyone travelling down this road in the future the CSS/LESS to remove both comments and likes:

#OperatorSingleWindowPageContainer [data-item-marker="SocialFeedContainer"] [data-item-marker="Comments"] {
    display: none;
}
#OperatorSingleWindowPageContainer [data-item-marker="SocialFeedContainer"] [data-item-marker="UsersWhoLikeItButton"] {
    display: none;
}
#OperatorSingleWindowPageContainer [data-item-marker="SocialFeedContainer"] [data-item-marker="Like"] {
    display: none;
}

 

Show all comments

We are running out of space for buttons in the usual places.  We have removed the icons in the communications panel at the top of the Actions Dashboard (see this article).  Is there any way to add buttons back in?

I have tried adding a button setting 'parentName' to "CaseSectionActionsDashboardMainContainerContainer" without success.

Thanks,

Like 0

Like

3 comments

Please clarify your task: do you need to return the buttons that were removed from the Actions Dashboard or do you need to add some new buttons there? Maybe you could share some image of what it should look like?

Oscar Dylan,

We need to add some new buttons.  We have removed the facebook, telegram, message and other buttons (which are actually tabs I think) from the Actions Dashboard, is it at all possible though to put a 'Terrasoft.ViewItemType.BUTTON' in their place?

Gareth Osler,

 

It's not possible exactly in the tabs (you are right, Email, Call, Activity etc. on the actions dashobard are tabs), but there are elements like ActualDcmSchemaInformationButton button and PlaybookButton button that are inserted to the RightHeaderActionContainer element of the SectionActionsDashboard and you can use those as an example. Additionally to it, if you ran out of space on the page you can always add additional buttons to the "Actions" button (override the getActions method on the edit page schema) and call the logic needed from these buttons.

Show all comments

Hi,

I tried to override the CaseInserting Event subprocess on a custom package.

I created a replacement object for the case entity and created a new subprocess for the "before inserting" event.

The new subprocess is not called the old one is called.

Like 0

Like

2 comments

Hi Stefano,

 

We would need to conduct a deeper analysis of the issue to provide you with a solution. Please write to us at support@creatio.com so we could help you.

 

Best regards,

Max.

Max,

Hi Max, I will write to support on monday

Show all comments

Is there a system table that can be queried to find out which section and/or detail run process menu(s) a process is found in?  Or any other way of doing this?

 

*Edit*  A query to find out what section(s) an object is a detail in would be quite helpful.

 

Thanks,

Like 1

Like

3 comments

Hi Gareth,

 

Thank you for reaching out!

 

This is the ProcessInModules table.

 

Also, there is no differentiation in Creatio between section and detail objects. So basically, an object is the same for a detail and a section. You could use the following script:

 

SELECT DISTINCT ss.Name , 
CASE 
WHEN EXISTS (SELECT 1 FROM  SysModule WHERE SysModuleEntityId IN (SELECT Id FROM SysModuleEntity WHERE SysEntitySchemaUId = ss.Uid)) THEN 'Section' 
WHEN EXISTS (SELECT 1 FROM  SysDetail WHERE EntitySchemaUId = ss.Uid) THEN 'Detail' 
else '' 
END AS "Section/Detail"
FROM SysSchema ss 
WHERE EXISTS SELECT 1 FROM  SysModule WHERE SysModuleEntityId IN (SELECT Id FROM SysModuleEntity WHERE SysEntitySchemaUId = ss.Uid) 
OR EXISTS
 (SELECT 1 FROM  SysDetail WHERE EntitySchemaUId = ss.Uid)
AND 
 ss.ManagerName = 'EntitySchemaManager'

 

Best regards,

Anastasiia

*Edit* The below queries return both active and inactive processes., at a glance I am not able see how to select active only.

 

The query we arrived at to list the processes in the run process menu of sections:

SELECT SM.Caption AS [Section Name], SS.Caption AS [Process Name] 
FROM ProcessInModules AS PIM 
JOIN SysModule AS SM ON PIM.SysModuleId = SM.Id 
JOIN SysSchema AS SS ON PIM.SysSchemaUId = SS.UId; 

And the query to list the processes in the run process menu of individual details:

SELECT SD.Caption AS [Detail Name], SS.Caption AS [Process Name] 
FROM ProcessInDetails AS PID 
JOIN SysDetail AS SD ON PID.SysDetailId = SD.Id 
JOIN SysSchema AS SS ON PID.SysSchemaUId = SS.UId; 

I would like to be able to say what sections a detail appears in, but would imagine this information to be buried deep in Creatio system tables.

 

If anyone can check the above queries I would be grateful!

Hi Gareth,

 

The queries you have written are correct. However, it's hard to check which details belong to which sections by a DB query as details are connected to a page in the page's schema. So you need to decode the schema's content and filter in it. Such a query is hard to build and it will take a long time for it to get executed.

 

Best regards,

Anastasiia

Show all comments

Hi

I created a custom section and I use it for filtering on a contact lookup in case portal page.

The search returns an empty result because the query use the SysEmpty table, not my custom section table.

I give all permission on the custom sectio for the portal users, but nothing change.

What am I doing wrong?

Like 0

Like

2 comments

Hi Stefano,

 

There might be multiple causes of this behavior.

First of all please keep in mind that access rights might be inherited and since your custom section is based on Contact lookup - permissions are checked for Contacts as well as for your Custom section. 

 

We also recommend looking at the SysSSPEntitySchemaAccessList table. There should be a record of the schema with which you have a problem. For portal users, by default, all schemas are considered to be administered and inaccessible. In order that portal users can use them, this schema must be in the lookup (the list of objects available to portal users). In other words - it must be in the SysSSPEntitySchemaAccessList table. After adding this schema to this table, the problem should be solved.

 

Should the above trouble-shooting not resolve your issue - please send us an email with detailed explanations of your problem to support@creatio.com so we may inspect and analyze your specific case (as it is too few details available by now and further evaluation will be required for precise solution)

 

Best Regards,

Dan

Denis Bidukha,

Thank you very much, for your suggestion.

Adding the missing record in the SysSSPEntitySchemaAccessList table solved my problem.

Show all comments

The above question has already been answered here:

How to remove communication options under progress bar ? | Community Creatio

 

Quoting the answer given:  "The code below should be added to the diff array of the ActionsDashboard module of your section".

I'm not sure where to find the "ActionsDashboard module of your section", could you help please.

 

Thanks,

Like 0

Like

1 comments

For reference and anyone who happens this way in the future there is some discussion on this in the linked article above.

Show all comments