It looks like in 8.1.3, when clicking the magnifying glass on a lookup field which is configured to show the lookup page modal popup, the handler crt.OpenSelectionWindowRequest is now called instead of crt.OpenLookupPageRequest. Is is the case that the old handler has been swapped for the new one? Why has this been done? And are there any important differences to be noted? It's broken some of our client's custom code in the upgrade, and from a surface view it looks like it works in much the same way as the old handler and that simply swapping the code to use the new handler instead of the old works, but don't want to make any assumptions on that. Anybody have any insight on this?

Like 2

Like

10 comments

Hmm. Good find. I’ll have some broken customizations as well. Hopefully we’ll get an official word about the change. This isn’t the first time I’ve had things break from changes to core Freedom UI things. I like using Freedom UI but at times it feels like a moving target. We need some commitment from Creatio about avoiding breaking changes. 
Ryan

Hi Harvey, 

I just tested this in an 8.1.3.6734 system and both "crt.OpenSelectionWindowRequest" and "crt.OpenLookupPageRequest" did open the selection/lookup window for me. However, using the results seemed to work differently depending on which request I used, it didn't work to just change the request name and leave the rest of the code as-is. So they do appear to possibly be slightly different requests, at least from my very limited tests so far 🤷🏼‍♂️

Ryan

Interesting, thanks for the additional info Ryan! For triggering the lookup page from code I think we'll stick with the original method for now then.

 

But a little PSA for anyone wondering why their code overriding the crt.OpenLookupPageRequest handler to intercept and add filters/perform other logic when a user triggers a lookup page on a lookup field configured to view as "Selection window" rather than dropdown list, they should now be overriding crt.OpenSelectionWindowRequest instead. Hopefully we'll get some clarification on why this has changed and any implications.

Harvey Adcock,

8.1.3 is the first release with this API published, and Creatio mentioned the API for Freedom UI selection window in the 8.1.3 release notes. At the same time, we left it without changes so as not to break possible customizations with the old unpublished API. However, the old API is effectively deprecated, and the new API should be used from now on.

The full article for the Academy is almost ready and will be officially published soon.
Here is part of main information (maybe some parts will be changed, that's why please follow the updates): 
In order to open the lookup window, you have to use crt.OpenSelectionWindowRequest:
 

/**
 * @publicApi
 */
@CrtRequest({
    type: 'crt.OpenSelectionWindowRequest',
})
export class OpenSelectionWindowRequest extends BaseRequest {
    public itemAttributeName?: string;
    public itemsAttributeName?: string;
    /**
     * @publicApi
     */
    public entitySchemaName?: string;
    /**
     * @publicApi
     */
    public schemaName?: string;
    /**
     * @publicApi
     */
    public filtersConfig?: FiltersConfig;
    /**
     * @publicApi
     */
    public features?: PageLookupFeatures;
    /**
     * @publicApi
     */
    public selectionState?: SelectionState;
    /**
     * @publicApi
     */
    public afterClosed?: (result: SelectionWindowResult) => void;
    /**
     * @publicApi
     */
    public caption?: LocalizableString;
}

 

Add the following code to your custom handler:

handlers: /**SCHEMA_HANDLERS*/[
			{
				request: "usr.OpenLookupRequest",
				handler: async (request, next) => {
					devkit.HandlerChainService.instance.process({
						type: "crt.OpenSelectionWindowRequest",
						scopes: [...request.scopes],
						$context: request.$context,
						entitySchemaName: "Contact",
						// caption: 'Responsible',
						schemaName: 'CustomLookupPage',
						itemAttributeName: 'LookupAttribute_2mnilrq',
						// itemsAttributeName: 'Contact_List',
						afterClosed: async (result) => {
							if (!result.canceled) {
								const lookupValues = await result.getLookupValues();
								const value = lookupValues[0];
								if (value) {
									alert(value?.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*/,

where

entitySchemaName - the name of the entity schema whose data is displayed in the lookup window. Optional parameter. If not specified, the data source is taken from the attribute specified in itemAttributeName

caption - optional parameter, displayed in the window title. If caption is not specified, the caption is taken from the attribute specified in the itemAttributeName parameter. If itemAttributeName is not specified, then from the entity schema.

schemaName - the name of the schema that is displayed in the lookup window. Optional parameter. Default is BaseLookupPageTemplate

itemAttributeName - the name of the attribute from which the title is taken, the name of the entity schema and in which the result of the selection in the window will be written. Optional parameter. As a rule, this is the attribute with which the Combobox control is associated.

itemsAttributeName - the name of the attribute from which the data source name is taken. Optional parameter.

afterClosed - callback function returning the result of the selection in the window. Optional parameter.

filtersConfig- describes the filter to be applied to the data. Optional parameter

P.S. Additionally, users can enable features and much more, which you're able to read from the article on the Academy in the near future.

 

Anhelina,

Thanks for this Anhelina. 

Anhelina, 

Hi!

How i can filter SelectionWindow by using value from lookup field on page? 

 

I try this: 

{
   request: "usr.AddSection",
   handler: async (request, next) => {
 
       const id = request.$context.PDS_Transport2_93i8xm8;
 
 
       request.$context.executeRequest({
           type: "crt.OpenLookupPageRequest",
           $context: request.$context,
           entitySchemaName: "Section",
           features: {
               select: {
                   multiple: true,
                   selectAll: false,
                   resultType: 'lookupValues'
               },
               create: {
                   enabled: false
               }
           },
           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": "Transport"
                                   },
                                   "isAggregative": false,
                                   "dataValueType": 1,
                                   "rightExpression": {
                                       "expressionType": 2,
                                       "parameter": {
                                           "dataValueType": 1,
                                           "value": id.value
                                       }
                                   }
                               }
                           },
                           "logicalOperation": 0,
                           "isEnabled": true,
                           "filterType": 6,
                           "rootSchemaName": "Section"
                       }
                   }
               }
           },
           afterClosed: function(selectedItems) {
               const textValues = Object.values(selectedItems).map(item => item.displayValue).join(', ');
               request.$context.PDS_SectionUpload_h11bk0p = textValues;
           }
       });
   }
}

but always get error: The data types nvarchar and uniqueidentifier are incompatible in the add operator.

Ryan Farley,

Maybe you can help?

 

Grygorii Synieok,

You forgot to await the value when getting the attribute. 

Change to this (note the added "await"): 

const id = await request.$context.PDS_Transport2_93i8xm8;

Ryan

Ryan Farley,

Thank you!

But another problem was with: "dataValueType":10 and  "comparisonType":3 with this parametrs works fine.

Full code:

{
    request: "usr.AddSection",
    handler: async (request, next) => {
 
        var autoId = await request.$context.PDS_UsrTransport2;
 
 
        request.$context.executeRequest({
            type: "crt.OpenLookupPageRequest",
            $context: request.$context,
            entitySchemaName: "SectionAuto",
            features: {
                select: {
                    multiple: true,
                    selectAll: false,
                    resultType: 'lookupValues'
                },
                create: {
                    enabled: false
                }
            },
            filtersConfig: {
                filterAttributes: [
                    {
                        name: 'MyFilter',
                        loadOnChange: false
                    }
                ],
                attributesConfig: {
                    MyFilter: {
                        value: {
                            "items": {
                                "29e16d42-36f1-4e04-9029-4321cbb2494d": {
                                    "filterType": 1,
                                    "comparisonType":3,
                                    "isEnabled": true,
                                    "trimDateTimeParameterToDate": false,
                                    "leftExpression": {
                                        "expressionType": 0,
                                        "columnPath": "Transport"
                                    },
                                    "isAggregative": false,
                                    //"dataValueType": 1,
                                    "rightExpression": {
                                        "expressionType": 2,
                                        "parameter": {
                                            "dataValueType": 10,
                                            "value":autoId.value
                                        }
                                    }
                                }
                            },
                            "logicalOperation": 0,
                            "isEnabled": true,
                            "filterType": 6,
                            "rootSchemaName": "SectionAuto"
                        }
                    }
                }
            },
            afterClosed: function(selectedItems) {
                const textValues = Object.values(selectedItems).map(item => item.displayValue).join(', ');
                request.$context.PDS_UsrSection = textValues;
            }
        });
    }
}

Hello Harvey,

 

I've a 8.1.3 environment and on some pages the crt.OpenLookupPageRequest works correctly  while on other pages it doesn't open the required lookup

Do you have the same issue ?

 

 

 

 

 

Show all comments

Hi Comunity,

We have a lookup (Contact) in a custom Section. When the modal page of the Contact opens we would like another default field and not the 'Full Name' to be the default one

Example:

How it is :

How we would like it to be:

How can this be achieved ?

Sasori

Like 0

Like

3 comments
Best reply

Hello!

 

Unfortunately, it's impossible to make such a change with basic tools, only by development. 



We've registered it in our R&D team backlog for consideration and implementation in future application releases.

 

Examples of the implementation of your task are available here https://community.terrasoft.ua/questions/sdelat-mobilnyy-telefon-standa….



Best regards,

Mariia

Hi Community,

Any update ?

Hello!

 

Unfortunately, it's impossible to make such a change with basic tools, only by development. 



We've registered it in our R&D team backlog for consideration and implementation in future application releases.

 

Examples of the implementation of your task are available here https://community.terrasoft.ua/questions/sdelat-mobilnyy-telefon-standa….



Best regards,

Mariia

Thank you very much Mariia!

Show all comments

Hello Creatio community

Here is the Scenario

1- Open Account Mini Page

2- Open Modal Window of City/Click New

3- City Edit Page will open in background, meanwhile the AccountMiniPage is still open

 Is it possible that when doing step 2,  the City Edit page appears , and that after adding a city and clicking Save, we are redirected to the MiniPage ?

Kind regards

Sasori

 

Like 0

Like

1 comments

Hello,

 

Thank you for your report.

As for now, the lookups on the mini pages could be only as a dropdown list.

We have already registered the bug for our R&D team to fix this functionality in further releases. I will assign your case to this project in order to increase its priority.

Show all comments

Hello guys!

How can I make these control buttons disabled, and enabled again when there is not result in search?

Please help me. Any ideas are valueable!

Like 0

Like

4 comments

Hello Muhammadjon,

 

Please note that it is only possible to implement such logic with the means of development, as such an option is not available using regular user tools. Please feel free to look for ideas here on community or on Creatio Academy. 

 

Kind regards,

Mira

Mira Dmitruk,

Hello Mira,

 

There is no way to do that? Do you have any idea how to make this development tools?

 

 

 

Hello,

 

Unfortunately, we have no examples of such logic implemented and this is considered to be a development consultation, which technical support does not provide. You could contact your manager and specify with them if it is possible for you to receive such a consultation.

 

Kind regards,

Mira

Mira Dmitruk, Thanks You!

Show all comments

How to disable the Select All button on Modal dialog box?

Like 0

Like

4 comments

Kindly Suggest

Roman Rak,

 

Thanks Roman but the links are referring to the section objects. I want to disable the Action Item(Select All) in Lookup Config - please find the screenshot added in the current post.

 

I have tried by overriding the getSelectionControlsConfig and getActionsMenuConfig from LookupPageViewGenerator schema module but it looks like the method is not getting executed.

Kindly suggest

 

 

Hello Anupama,

 

Thank you for your reply. 

If to talk about a selection card from a lookup,  the getSelectionControlsConfig method in the LookupPageViewGenerator. The BaseLookupPageV2 scheme is responsible for this page/window. For example, previously the Add button was called: SeparateModeAddRecordButton, the ActionsButton is action button, etc.. You can override and customize the visibility of these buttons as you need.

 

Here are some examples as well:

Kind regards,

Roman

Show all comments

Hi Team,



I would like to retain the values/records in the detail when i click on + sign (Add record in the detail) into the modal pop-up of multiselect lookup.



STEP 1: I'm using a multiselect lookup object and selecting couple of values on Add Record of a detail (i.e., clicking + sign)

 

STEP 2 : After selecting values from step 1, when i click + sign again, i would like to retain the values available in the detail grid to the modal popup with the checkbox selected.

 

STEP 3 : The  multiselect lookup's modal pop-up should be like this.

 

when one of the selected value in STEP 1 (ex., incoming document 1) is unchecked and a new value is selected (ex., Regulation 3) the insertion should act accordingly.



Incoming Document 1 --> Should be removed from detail (since its value is unchecked now)

Minutes 2 --> should be available in the detail (since already selected in STEP 1)

Regulation 3 --> Should be added to the detail.





Kindly guide to achieve the above!



Thanks in advance!







Regards,

Bhoobalan P.

 

 

 

Like 0

Like

1 comments

Hi Bhoobalan,

 

Basically there are two tasks that you need to solve:

 

1) Display already added records to the detail in the modal window that is opened upon adding new records to a detail

2) Check these added records in the list

 

As for the 1-st task - you will need to override the openLookupWithMultiSelect method from the LookupMultiAddMixin mixin (for example you can create your own module and copy the code of the original LookupMultiAddMixin mixin and use it in the detail schema). The part of code that checks already records is:

const filtersConfig = this.createAlreadyAddedRecordsFilter();

As for the 2-nd task you will need to dynamically change CSS for elements in the modal window and add grid-row-selected CSS to it. Unfortunately we don't have any practical examples on this particular step.

 

Best regards,

Oscar

Show all comments

Does anyone know the purpose of the overriding of the deleteRecords method in Step 3 of the following Academy article on using a modal lookup window to populate a detail? https://academy.creatio.com/documents/technic-sdk/7-15/creating-detail-selection-lookup

 

When I remove this, it doesn't seem to have any impact on deleting records from the detail, and I can't tell what it's trying to achieve by lookup at the code and the vanilla deleteRecords method.

Like 0

Like

1 comments

Dear Harvey, 



This part of the code is needed for the correct work of multi-select in the grid of the detail. I would not recommend removing it as various issues with multi-select may occur. 

 

Best regards, 

Dennis 

Show all comments

I'm trying to configure a modal lookup window by following Example 2 in this academy page https://academy.creatio.com/documents/technic-sdk/7-15/creating-detail-selection-lookup and everything works as described, but I cannot figure out how to add a default sort to the modal lookup window - are there some parameters which can be added to the config object passed to the this.openLookup method call?

 

While on that subject, are there any other potential parameters which can be added to this config object which might be useful for other tasks?

Like 0

Like

1 comments

Dear Harvey, 



There is no description for all parameters of the lookup config. The possible way is to check the existing openLookup calls. 

Sorting can be specified in sortedColumns parameter. 

You can find the example in method selectPeriod in the ForecastTab. 

Collection of columns with sorting parameters is passed to it this way: 

var config = {

    entitySchemaName: "Contact",

    multiSelect: false,

    columns: ["Name", "Account.Name"],

    sortedColumns: [{

        name: "Account.Name",

        orderPosition: 0,

        orderDirection: this.Terrasoft.core.enums.OrderDirection.ASC

    }]

};

this.openLookup(config, this.lookupCallback, this);



Kind regards, 

Roman

Show all comments

Hi, 

In need to call an api and then show the result in a lookup modal for the user to select a result record. 

I have implemented the api call in a Business Process. I have implemented a button that opens a lookup modal. The problem is that I dont know how to make the lookup modal to get the results from the business process that calls the api. 

Regards,

 

Javier Turell 

Like 1

Like

3 comments

Dear Javier,

Since you are calling an external web service from business process, you need to parse a received reply and use the retrieved data to open a modal window.

Please see this article on how to parse a response from web service:

https://academy.bpmonline.com/documents/administration/7-14/setting-par…

As you will receive a response, parse it into separate business process parameters. Use auto-generated page or pre-configured page to display results to the user.

Regrads,

Anastasia

Can I show an selectable list on a auto-generated page or pre-configured page? I tryed to do that and I didnt find the way to do it. 

I would like to use the lookup modal to show the result and select a record, Is that posible? ​​​​​​



Regards, 

Javier

Javier Turell,

You can add any suitable page items of auto-generated page and pass it values from process parameter:

https://prnt.sc/nysad4

Regards,

Anastasia

Show all comments