Hi Everyone,

I'm looking to filter a lookup value based on "StartDate" and "EndDate" column field which is present in the lookup object . I attempted to achieve this through the following handler code, where I compare the current date with the End Date. However, it didn't work. Does anyone know of a better approach to filter the lookup value?

Below is my handler code:

{

    request: "crt.LoadDataRequest",

    handler: async (request, next) => {

        // filter the contact lookup for the account

                     

        if (request.dataSourceName !== "LookupAttribute_jw8dbjp_List_DS") {

            return await next?.handle(request);

        }

        // Add filter for UsrEndDate not less than the current date

        const currentDate = new Date();

        const filter = new sdk.FilterGroup(sdk.ComparisonType.And);

        filter.addItem(sdk.Filter.createColumnFilterWithParameter(

            "UsrEndDate",

            sdk.ComparisonType.GreaterThanOrEqual,

            currentDate

        ));

        request.parameters.push({

            type: "filter",

            value: filter

        });

        return await next?.handle(request);

    }

}

Like 0

Like

1 comments

Hello,

Take a look at this discussion, in there you can find an example of how to configure and add a needed filter.

In order to get the exact filter you need, use the test list method described there.

Show all comments

How can we apply custom filters on Lookups in Freedom UI? I can see that there is some existence of a filtersConfig potential property for the object passed as the first parameter to executeRequest, but cannot find any examples or information on how this should be configured in Academy or on other Community questions. We are trying to use this to associate records to a parent record using the + button on a Freedom UI "detail" list, but we don't want any records already associated with any parent by foreign key to be eligible for association using the lookup, and also have some other conditions to apply based on the child entity. Our environment is currently on 8.1 Quantum.

 

Here is the relevant excerpt from the handler on our form page, without any filters applied and with the non-relevant logic applied in the afterClosed area removed for brevity:

request.$context.executeRequest({
	type: "crt.OpenLookupPageRequest",
	$context: request.$context,
	entitySchemaName: "Order",
	caption: "Select Quotes to associate with the Lead",
	features: {
		select: {
			multiple: true,
			selectAll: false,
			resultType: 'lookupValues'
		},
		create: {
			enabled: false
		}
	},
	afterClosed: async function(selectedItems) {
		// logic here
		return next?.handle(request)
	}
});

 

Like 0

Like

3 comments

Hello,

Here is an example of OpenLookupPageRequest with a filtersConfig.

handlers: /**SCHEMA_HANDLERS*/[
			{
				request: "usr.OpenLookupRequest",
				handler: async (request, next) => {
					devkit.HandlerChainService.instance.process({
						type: "crt.OpenLookupPageRequest",
						scopes: [...request.scopes],
						$context: request.$context,
						entitySchemaName: "Contact",
						// caption: 'Responsible',
						schemaName: 'CustomLookupPage',
						itemAttributeName: 'LookupAttribute_2mnilrq',
						// itemsAttributeName: 'Contact_List',
						afterClosed: (result) => {
							alert(result?.displayValue ?? '');
						},
						filtersConfig: {
							filterAttributes: [
								{
									name: 'MyFilter',
									loadOnChange: false
								}
							],
							attributesConfig: {
								MyFilter: {
									value: {
										"items": {
											"29e16d42-36f1-4e04-9029-4321cbb2494d": {
												"filterType": 1,
												"comparisonType": 11,
												"isEnabled": true,
												"trimDateTimeParameterToDate": false,
												"leftExpression": {
													"expressionType": 0,
													"columnPath": "Name"
												},
												"isAggregative": false,
												"dataValueType": 1,
												"rightExpression": {
													"expressionType": 2,
													"parameter": {
														"dataValueType": 1,
														"value": "Super"
													}
												}
											}
										},
										"logicalOperation": 0,
										"isEnabled": true,
										"filterType": 6,
										"rootSchemaName": "Contact"
									}
								}
							}
						}
					});
					return next?.handle(request);
				}
			}
		]/**SCHEMA_HANDLERS*/,

If you don't know how to build a proper filter here is a small tip. On a Freedom UI page add a list with the object you want to filter. In this list add a static filter with a condition you want to apply to a OpenLookupPageRequest and save it. As a result, in the code of this page, you can find the full filter code, all you need to do is to replace "MyFilter" with it.

Question on OpenLookupPageRequest. In an edit scenario, could you pass the already selected options so that they appear already selected in the lookup list?

You can use the option selectionState to predefine selected rows, which will be pre-selected

type: "crt.OpenLookupPageRequest",
	...
	selectionState: {
		type: 'specific',
		selected: [
			'9d06bf9f-eb7a-4849-b83d-cbba994f185d',
			'49ba9a9e-2e28-48cb-b1bc-81b7871acb9d',
		],
	},

 

Show all comments

I have a problem filtering a lookup filed using Freedom UI.

The issue here:

The first lookup filed linked to the Contact entity

The second lookup filed's entity Account, contains a field "SMPrimaryAccountOwner" and it should be equal to the first filed value. 



Here is the filter:

 

{
				request: "crt.LoadDataRequest",
				handler: async (request, next) => {
					// filter the contact lookup for the account
					debugger;
					if(request.dataSourceName !== "LookupAttribute_emk4fel_List_DS") {
						return await next?.handle(request);
					}
 
 
					const account = await request.$context.LookupAttribute_r6avpkd;
					if (account) {
						const filter = new sdk.FilterGroup();
						await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SMPrimaryAccountOwner.Id", account.value);
 
						// note, these lines are only needed due to an issue with filters in Creatio-DevKit SDK
						// expected to be fixed in Creatio 8.1
						//const newFilter = Object.assign({}, filter);
						//newFilter.items = filter.items;
 
						request.parameters.push({
							type: sdk.ModelParameterType.Filter,
							value: filter
						});
					}
 
					return await next?.handle(request);
 
				}
			}



And here is the error on the console:



 

Maybe anyone here had the same issue.

Like 0

Like

2 comments
Best reply

Try changing to just the field "SMPrimaryAccountOwner" and not the ".Id" part at the end.

await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SMPrimaryAccountOwner", account.value);

Also, even if you're on 8.1 the commented lines are necessary - the issue that works around was *not* fixed in 8.1.

Ryan

Try changing to just the field "SMPrimaryAccountOwner" and not the ".Id" part at the end.

await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SMPrimaryAccountOwner", account.value);

Also, even if you're on 8.1 the commented lines are necessary - the issue that works around was *not* fixed in 8.1.

Ryan

Try adding the filter for "SMPrimaryAccountOwner" and not "SMPrimaryAccountOwner.Id", as in: 

await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SMPrimaryAccountOwner", account.value);

Also, the workaround that is commented out is still needed in 8.1. It was not fixed in 8.1.

Ryan

Show all comments

Hello community!

 

I am trying to filter some values of a lookup, and this is the error i get in the console

Does anyone know how can I fix it, or where it's coming from?

Thank you.

Like 0

Like

3 comments

Hi Nicolaiciuc,

 

Can you share the code that you have implemented to filter?

 

Regards,

Sourav

 

Sourav Kumar Samal,

Hello, here is my code:

 

"LbkNewSearchCollateralsInOpp": {

                "dataValueType": Terrasoft.DataValueType.LOOKUP,

                "lookupListConfig": {

                    "filters": [

                        function() {                        

                            // adding the filter to the detail

                            var parentProduct = this.get("OpportunityProductInterest");

                            var filterGroup = Ext.create("Terrasoft.FilterGroup");

                            if (parentProduct) {

                                var parentProductId = parentProduct.value;

                                var subFilters = this.Terrasoft.createFilterGroup();

                                

                                var esq = Ext.create("Terrasoft.EntitySchemaQuery", {

                                    rootSchemaName: "OpportunityProductInterest"

                                });

                                esq.addColumn("Opportunity");

                                esq.getEntity(parentProductId, function(result) {

                                if (result.success) {

                                   

                                    var opportunityId = result.entity.get("Opportunity").Id; 

                                    var newesq = Ext.create("Terrasoft.EntitySchemaQuery", {

                                        rootSchemaName: "LbkProductCollateralTypes"

                                    });

                                    newesq.addColumn("LbkProductCollateralTypesRemainingAllocation");

                                    

                                    var esqFilter = newesq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Opportunity.Id", opportunityId);

                                    newesq.filters.add(esqFilter);

                                    newesq.getEntityCollection(function (newresult) {

                                        if (newresult.success) {

                                          

                                                newresult.collection.each(function (item) {

                                                

                                                   

                                                    var defaultRemainingInBaseCollateral = item.values.LbkProductCollateralTypesRemainingAllocation;

                                                    console.log(defaultRemainingInBaseCollateral);

                                                    subFilters.addItem(this.Terrasoft.createColumnFilterWithParameter(

                                    Terrasoft.ComparisonType.GREATER, defaultRemainingInBaseCollateral, 0));

                                

                                filterGroup.add("Remaining value greater than 0",

                                                Terrasoft.createExistsFilter("[LbkCollateralsNew:LbkNewSearchCollateralsInOpp].Id",

                                                                                subFilters));                                                    

                                                

                                            });

                                        }

                                    }, this);

                                }

                            }, this);

                               

                                

                            }

                            return filterGroup;

                        }

                    ]

                }

            }

Nicolaiciuc Maria,

This won't work. The ESQ query you are attempting is asyncronous, meaning the filter function will return/complete before the ESQ has completed. You'll need to split this into two parts. One part will retrieve the values from LbkProductCollateralTypes and store them in an attribute on the page. This would be called in the onEntityInitialized. The idea is that you're pre-fetching the values from that object beforehand. Then, in the filter function, you'd be reading that attribute to construct and return the FilterGroup as needed, all synchronous since you've already pre-fetched the LbkProductCollateralTypes values in the onEntityInitialized. The filter function won't get called until the lookup is used, so the code in the onEntityInitialized will have completed before then and the LbkProductCollateralTypes values in the attribute will be available by then. Does that make sense? 

Ryan

Show all comments

Hello, community!

This is a selection window for my lookup. Lets take this example, I should not be able to select collaterals that have remaining allocation 0. My problem is that this field is being populated by a process, and the regular lookup filtration does not work. Is there any way to make that select button throw an error/ not let the user save their pick? As in, if remaining allocation equals 0 => select button will do nothing.

Like 0

Like

1 comments

Hello Maria,

Modifying this module window is quite a hard task to do. I believe is your case attribute filter will work just fine:

attributes: {
			"{Your lookup column Name}": {
                "dataValueType": Terrasoft.DataValueType.LOOKUP,
                "lookupListConfig": {
                    "filters": [
                        function() {
                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
                            filterGroup.add("IsNotNull",
                                Terrasoft.createColumnFilterWithParameter(
                                    Terrasoft.ComparisonType.GREATER,
                                    "[{Your lookup column Name}:Id].RemainingAllocation", 0));
                            return filterGroup;
                        }
                    ]
                }
            }
		},

With these records where the remaining allocation is 0 will not be displayed.

Show all comments

Hi Team,



The onLookupDataLoaded: function(config) is not triggered for a custom lookup field in the object. However, the same is triggering for the OOTB lookup columns.



When the control is passed to the lookup, the onLookupDataLoaded event has to trigger but it isn't triggering for custom/newly created lookup in objects.



Are any additional changes required for new lookup columns added to the object?



BR,

Bhoobalna Palanivelu.

Like 0

Like

1 comments

Hi Bhoobalan,

 

This method was triggered for the custom lookup added to the page on my side. Are you sure the method is not triggered?

 

Best regards,

Oscar 

Show all comments

 

 

Hello, I am going to filter only by INN in the lookup, how i can delete other options?

Like 0

Like

0 comments
Show all comments

Hi Community,

 

I have this situation where I need to create a filter for the lookup Group (Fig. 2) based on my custom field that I've created on SysAdminUnit object (Fig.1).

 

Fig. 1

 

 

Fig. 2

 

I've managed to add the custom field to the SysAdminUnitPage (Fig.3). However, the custom field is not "connected" to the object field, because this page is different from the others and does not have entitySchemaName attribute (Fig. 4).

 

Fig.3

 

Fig.4

 

I would like to know:

  1. How can I "connect" the field that I've created on my SysAdminUnitPage to the field I've created on the SysAdminUnit object?
  2. How can I create a filter for the lookup Group inside CasePage using my custom field?

Any suggestion on how to achieve this? Thank you.

 

Best Regards,

Pedro Pinheiro

Like 0

Like

5 comments

Hi Pedro,

 

If you need to create a filter of the Group lookup on the case page then why do you replace the SysAdminUnitPageV2? And which case and account do you expect to see on the SysAdminUnitPageV2 for some role (for example for "System administrators")? Also I cannot see any filtration logic on the SysAdminUnitPageV2 module code you've shared.

 

You need to create a filter on the CasePage using an example provided here.

 

Best regards,

Oscar

Hi Oscar,

 

Thank you for the response.

 

My question consists of two parts:

 

1) I've created a replacing page of the "SysAdminUnitPageV2", so I could add my custom boolean field "Case" and the pre-built lookup field "Account". Since the "Account" field is not custom, I only added the field on my "SysAdminUnitPageV2" page through the “diff” array (image below). Every time I change and save my "Account" value, it will automatically update the value in the database for my specific record. However, the same does not happen to my custom field "Case".

I’ve created the “Case” field the same way "Account" field was created, but I think I'm missing some page logic that is responsible to store my “Case” values in the database.

 

 

2) The lookup filter that I want to add is for the "Group" lookup field inside the "CasePage". This filter should use the "Case" field, previously added to the "SysAdminUnit" object. With the example you provided I was able to complete this second part.

 

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

In the Fig.4 modify the "bindTo": "Case" to "bindTo": "UsrCase", save the schema and refresh the "role" page after that. Try saving some value and let me know about the result.

 

Best regards,

Oscar

Oscar Dylan,

 

I've made the changes, but my page cannot find the UsrCase column. I think it's because this page does not have the "entitySchemaName" attribute. But even if I try to add the "entitySchemaName" attribute the page will throw an exception.

 

 

Error Translation: "It was not possible to find the column through the following configuration."

 

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

To achieve your first result you need to:

 

1) Create a replacing object selecting the VwSysAdminUnit object as a parent

2) Create the lookup column with the "UsrCase" code and "Case" title inside the object from step 1.

3) Save and publish the object from step 1.

 

As a result here you should get this result:

4) Execute the following query in the database (please note that if you already have customizations in the VwSysAdminUnit table (new columns inside it) then the query that should be executed in your case can differ (all the columns of the already existing replacement should be mentioned in the query, study it before running)):

IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[VwSysAdminUnit]'))
DROP VIEW [dbo].[VwSysAdminUnit]
GO
CREATE VIEW [dbo].[VwSysAdminUnit]
AS
SELECT [SysAdminUnit].[Id]
	,[SysAdminUnit].[CreatedOn]
	,[SysAdminUnit].[CreatedById]
	,[SysAdminUnit].[ModifiedOn]
	,[SysAdminUnit].[ModifiedById]
	,[SysAdminUnit].[Name]
	,[SysAdminUnit].[Email]
	,[SysAdminUnit].[Description]
	,[SysAdminUnit].[ParentRoleId]
	,[SysAdminUnit].[ContactId]
	,[SysAdminUnit].[IsDirectoryEntry]
	,[TimeZone].[Id] AS [TimeZoneId]
	,[SysAdminUnit].[UserPassword]
	,[SysAdminUnitType].[Id] AS [SysAdminUnitTypeId]
	,[SysAdminUnit].[AccountId]
	,[SysAdminUnit].[Active]
	,[SysAdminUnit].[LoggedIn]
	,[SysAdminUnit].[SynchronizeWithLDAP]
	,[LDAPElement].[Name] as [LDAPEntry]
	,[LDAPElement].[LDAPEntryId]
	,[LDAPElement].[LDAPEntryDN]
	,[SysAdminUnit].[SysCultureId]
	,[SysAdminUnit].[ProcessListeners]
	,[SysAdminUnit].[PasswordExpireDate]
	,[SysAdminUnit].[HomePageId]
	,[SysAdminUnit].[ConnectionType]
	,[ConnectionType].[Id] AS [UserConnectionTypeId]
	,[SysAdminUnit].[ForceChangePassword]
	,[SysAdminUnit].[LDAPElementId]
	,[SysAdminUnit].[DateTimeFormatId]
	,[SysAdminUnit].[Id] as [SysAdminUnitId]
	,[SysAdminUnit].[SessionTimeout] as [SessionTimeout]
	,[SysAdminUnit].[UsrCaseId] as [UsrCaseId]
FROM [SysAdminUnit]
INNER JOIN [SysAdminUnitType] ON [SysAdminUnitType].[Value] = [SysAdminUnit].[SysAdminUnitTypeValue]
LEFT JOIN [ConnectionType] AS [ConnectionType] ON [ConnectionType].[Value] = [SysAdminUnit].[ConnectionType]
LEFT JOIN [TimeZone] AS [TimeZone] ON [TimeZone].[Code] = [SysAdminUnit].[TimeZoneId]
LEFT JOIN [LDAPElement] ON [LDAPElement].[Id] = [SysAdminUnit].[LDAPElementId]
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_I]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [SysAdminUnit](
	[Id]
	,[CreatedOn]
	,[CreatedById]
	,[ModifiedOn]
	,[ModifiedById]
	,[Name]
	,[Email]
	,[Description]
	,[ParentRoleId]
	,[ContactId]
	,[IsDirectoryEntry]
	,[TimeZoneId]
	,[UserPassword]
	,[SysAdminUnitTypeValue]
	,[AccountId]
	,[Active]
	,[LoggedIn]
	,[SynchronizeWithLDAP]
	,[LDAPEntry]
	,[LDAPEntryId]
	,[LDAPEntryDN]
	,[SysCultureId]
	,[ProcessListeners]
	,[PasswordExpireDate]
	,[HomePageId]
	,[ConnectionType]
	,[ForceChangePassword]
	,[LDAPElementId]
	,[DateTimeFormatId]
	,[SessionTimeout]
	,[UsrCaseId])
SELECT [Id]
	,[CreatedOn]
	,[CreatedById]
	,[ModifiedOn]
	,[ModifiedById]
	,[Name]
	,[Email]
	,[Description]
	,[ParentRoleId]
	,[ContactId]
	,[IsDirectoryEntry]
	,(SELECT COALESCE(
		(SELECT [TimeZone].[Code] FROM [TimeZone]
			WHERE [TimeZone].[Id] = [INSERTED].[TimeZoneId]), ''))
	,[UserPassword]
	,ISNULL((SELECT [SysAdminUnitType].[Value] FROM [SysAdminUnitType]
		WHERE [SysAdminUnitType].[Id] = [INSERTED].[SysAdminUnitTypeId]), 4)
	,[AccountId]
	,[Active]
	,ISNULL([LoggedIn], 0)
	,[SynchronizeWithLDAP]
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[Name] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[LDAPEntryId] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[LDAPEntryDN] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,[SysCultureId]
	,[ProcessListeners]
	,[PasswordExpireDate]
	,[HomePageId]
	,COALESCE([INSERTED].[ConnectionType],
		(SELECT [ConnectionType].[Value] FROM [ConnectionType]
		WHERE [ConnectionType].[Id] = [INSERTED].[UserConnectionTypeId]), 0)
	,ISNULL([ForceChangePassword], 0)
	,[LDAPElementId]
	,[DateTimeFormatId]
	,[SessionTimeout]
	,[UsrCaseId]
FROM [INSERTED]
END
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_U]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE [SysAdminUnit]
SET [SysAdminUnit].[CreatedOn] = [INSERTED].[CreatedOn]
	,[SysAdminUnit].[CreatedById] = [INSERTED].[CreatedById]
	,[SysAdminUnit].[ModifiedOn] =[INSERTED].[ModifiedOn]
	,[SysAdminUnit].[ModifiedById] = [INSERTED].[ModifiedById]
	,[SysAdminUnit].[Name] = [INSERTED].[Name]
	,[SysAdminUnit].[Email] = [INSERTED].[Email]
	,[SysAdminUnit].[Description] = [INSERTED].[Description]
	,[SysAdminUnit].[ParentRoleId] = [INSERTED].[ParentRoleId]
	,[SysAdminUnit].[ContactId] = [INSERTED].[ContactId]
	,[SysAdminUnit].[IsDirectoryEntry] = [INSERTED].[IsDirectoryEntry]
	,[SysAdminUnit].[TimeZoneId] =
		(SELECT COALESCE(
			(SELECT [TimeZone].[Code] FROM [TimeZone]
				WHERE [TimeZone].[Id] = [INSERTED].[TimeZoneId]), ''))
	,[SysAdminUnit].[UserPassword] = [INSERTED].[UserPassword]
	,[SysAdminUnit].[SysAdminUnitTypeValue] =
		(SELECT [SysAdminUnitType].[Value] FROM [SysAdminUnitType]
			WHERE [SysAdminUnitType].[Id] = [INSERTED].[SysAdminUnitTypeId])
	,[SysAdminUnit].[AccountId] = [INSERTED].[AccountId]
	,[SysAdminUnit].[Active] = [INSERTED].[Active]
	,[SysAdminUnit].[LoggedIn] = [INSERTED].[LoggedIn]
	,[SysAdminUnit].[SynchronizeWithLDAP] = [INSERTED].[SynchronizeWithLDAP]
	,[SysAdminUnit].[LDAPEntry] =
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[Name] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntry]
		END
	,[SysAdminUnit].[LDAPEntryId] = 
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[LDAPEntryId] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntryId]
		END
	,[SysAdminUnit].[LDAPEntryDN] = 
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[LDAPEntryDN] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntryDN]
		END
	,[SysAdminUnit].[SysCultureId] = [INSERTED].[SysCultureId]
	,[SysAdminUnit].[ProcessListeners] = [INSERTED].[ProcessListeners]
	,[SysAdminUnit].[PasswordExpireDate] = [INSERTED].[PasswordExpireDate]
	,[SysAdminUnit].[HomePageId] = [INSERTED].[HomePageId]
	,[SysAdminUnit].[ConnectionType] = COALESCE([INSERTED].[ConnectionType],
		(SELECT [ConnectionType].[Value] FROM [ConnectionType]
		WHERE [ConnectionType].[Id] = [INSERTED].[UserConnectionTypeId]), 0)
	,[SysAdminUnit].[ForceChangePassword] = [INSERTED].[ForceChangePassword]
	,[SysAdminUnit].[LDAPElementId] = [INSERTED].[LDAPElementId]
	,[SysAdminUnit].[DateTimeFormatId] = [INSERTED].[DateTimeFormatId]
	,[SysAdminUnit].[SessionTimeout] = [INSERTED].[SessionTimeout]
	,[SysAdminUnit].[UsrCaseId] = [INSERTED].[UsrCaseId]
FROM [SysAdminUnit]
INNER JOIN [INSERTED] ON [SysAdminUnit].[Id] = [INSERTED].[Id]
END
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_D]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF DELETE
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM [SysAdminUnit]
WHERE EXISTS(SELECT * FROM [DELETED] WHERE [SysAdminUnit].[Id] = [DELETED].[Id])
END
GO

This query is for MS SQL, if your application is hosted using the PostgreSQL database then your query should be written using PostgreSQL syntax (you can copy the OOB VwSysAdminUnitPostgreSql SQL-script from the LDAP package, add your custom columns inside the ready script and execute it after that).

 

5) In the replaced SysAdminUnitPageV2 module add the following code to the diff array of the module:

{
					"operation": "insert",
					"parentName": "Header",
					"propertyName": "items",
					"name": "UsrCase",
					"values": {
						"bindTo": "UsrCase",
						"dataValueType": this.Terrasoft.DataValueType.LOOKUP,
						"layout": {
							"column": 0,
							"row": 1,
							"colSpan": 24
						}
					},
				}

6) Add the entitySchemaName: "VwSysAdminUnit", part to the replaced SysAdminUnitPageV2 module (below you can find an example of the correctly replaced module):

define("SysAdminUnitPageV2", [],
	function() {
		return {
			entitySchemaName: "VwSysAdminUnit",
			details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
			diff: /**SCHEMA_DIFF*/[
				{
					"operation": "insert",
					"parentName": "Header",
					"propertyName": "items",
					"name": "UsrCase",
					"values": {
						"bindTo": "UsrCase",
						"dataValueType": this.Terrasoft.DataValueType.LOOKUP,
						"layout": {
							"column": 0,
							"row": 1,
							"colSpan": 24
						}
					},
				}
			]/**SCHEMA_DIFF*/,
			attributes: {},
			methods: {}
		};
});

7) Save the module and refresh the page

 

As a result you will get a working lookup that references the "Case" object:

and

PS: also please share code itself, but not its screenshots, sometimes copying some ready code can save the time:)

 

Best regards,

Oscar

Show all comments

Hi community,

 

I need a way to sort the rows of a data grid according to the values present in a detail.

 

I have my detail in the candidate object like this:

 

Here is a small simplified diagram of the relationship between my lookup, my detail and my object:

I would like to run this sql query to filter the candidates :

SELECT c.* FROM technocandidats tc
RIGHT JOIN candidats c ON c.id = tc.candidat_id
WHERE tc.techno_id = n OR
tc.techno_id = n OR ...

where "n" will be the techno's id.

 

Is there a way to do this directly in the section's advanced filters?

 

Or better still, in a box on top of the section like the one in my candidat object where the detail appears? Or even better, make that in a preconfigured page ?

 

Best regards,

 

Julien Gunther

Like 0

Like

1 comments

Hello Julien,

 

I believe this should be possible as you have the connections between your objects. Could you please contact Creatio support team using support@creatio.com so we can help you with the filter setup in your system?

 

Thank you,

Bogdan S.

Show all comments

Hi Team,

 I have been using a lookup field and implementing a filter via LookupListConfig.



Here I have an issue in filtering the values.



Step 1: If the logged-in used belongs to the System Administrator role, the filter for the lookup is working fine and it shows the records.

 

Step 2: If the same user is removed from the System Administrator role, the filter is not working and it does not shows any records.

Here is the utilization of lookupListConfig

"UsrApplyName": {
		                "dataValueType": Terrasoft.DataValueType.LOOKUP,
		                "lookupListConfig": {
		                	columns: [ "Id" ],
		                    "filters": [
		                        function() {
		                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
									var CurContactAccount = Terrasoft.SysValue.CURRENT_USER_ACCOUNT.value;
		                          		filterGroup.add("IsActive",
		                                Terrasoft.createColumnFilterWithParameter(
		                                    Terrasoft.ComparisonType.EQUAL,
		                                    "UsrRecepientCompany",
		                                    CurContactAccount));
		                          		return filterGroup;
		                        }
		                    ]
		                }
					},

 

 

Kindly help me with the above hindrance and let me know what causes the difference and how to overcome it.





Regards,

Bhoobalan P.

 

 

 

 

 

 

Like 0

Like

1 comments

Hi Bhoobalan,

 

Please see this community post regarding the same question about ESQ and access rights - https://community.creatio.com/questions/access-issue-esq.

 

Best regards,

Oscar

Show all comments