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:
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.
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):
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 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?
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);});
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.
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.
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
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.
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.
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?
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.
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.
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,
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.
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.
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?
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?
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.
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.
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.
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'
*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!
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.
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)