By default, lookups are sorted on Name.



I have a lookup on a freedom UI page that I instead want to sort (ascending) based on an integer field on the lookup called "Order".



I can see "LookupAttribute_xxxx_List_Sorting" attributes within the page when debugging, I'm assuming these can be used to order the lookups but I'm not sure what data the attribute expects.



Thanks for any assistance!

Like 1

Like

6 comments
Best reply

After a year or so I decided to have another look at this and have managed to get it working via code.
 

For example, adding this handler on the Accounts_FormPage should filter the "Type" by "Id" descending.


(In the code block change the ">" to ">", can't seem to fix this in the reply editor)

 

{
	request: "crt.HandleViewModelInitRequest",
	handler: async (request, next) => {
		let sortingConfigList = await request.$context.Type_List_Sorting;
		let firstSortingConfig = sortingConfigList[0];
		firstSortingConfig.columnName = "Id";
		firstSortingConfig.direction = "desc"; //desc or asc
		return next?.handle(request);
	}
}

 

 

 

 

So the page context attribute we need to change is attributecode_List_Sorting.
This is a list of "order configurations" (so you can order by multiple columns for example)
So we just need to get the first item in this list and change the columnName from Name to whatever other field we need to order on
And we can optionally change the direction property to "desc" to order descending (it is "asc" by default).

The logic of the combobox is developed in the way that when the page os loaded the metadata for the combobox is generated additionally and it ignores custom sorting and always adds default sorting. I will notify the product owner about your question in the community so that the possibility of custom sorting could be developed and added in Fredom UI out-of-the-box. Thank you for helping us in making the app better!

Oleg Drobina,

Hello, is it available for Freedom UI current version?

This is definitely something we'd be interested in being able to do too. It was possible in Classic UI.

Any info on whether this is now possible in Freedom UI?

After a year or so I decided to have another look at this and have managed to get it working via code.
 

For example, adding this handler on the Accounts_FormPage should filter the "Type" by "Id" descending.


(In the code block change the ">" to ">", can't seem to fix this in the reply editor)

 

{
	request: "crt.HandleViewModelInitRequest",
	handler: async (request, next) => {
		let sortingConfigList = await request.$context.Type_List_Sorting;
		let firstSortingConfig = sortingConfigList[0];
		firstSortingConfig.columnName = "Id";
		firstSortingConfig.direction = "desc"; //desc or asc
		return next?.handle(request);
	}
}

 

 

 

 

So the page context attribute we need to change is attributecode_List_Sorting.
This is a list of "order configurations" (so you can order by multiple columns for example)
So we just need to get the first item in this list and change the columnName from Name to whatever other field we need to order on
And we can optionally change the direction property to "desc" to order descending (it is "asc" by default).

John Kingsbury,

That's excellent news. Thanks for sharing. 

Ryan

Show all comments

Hello Community, 

I wanted to disable/Remove AddNew button from lookup option in a editable detail. 

I could not see any option to edit the settings for the column in the editable detail.

I have attached the screenshot of the lookup in the detail.

Is there any way to set property to disable the option to add New record from the detail column in client schema?

I am able to remove "Add New" if I choose the same object for a lookup field in the form page and by unchecking "Enable adding new values" option in the settings of field. But I am not able to do it for the field in the detail.

 

Any suggestions are really helpful

 

Thanks

Gargeyi

Like 0

Like

2 comments

Hello Gargeyi,

 

In 8.0.6 there is an "Enable adding new values" option in the FreedomUI designer for the dropdown element:

You can disable this option in case you don't need to add new records from the dropdown.

Thankyou for your response Oleg,

 

But I wanted to disable it in the editable detail (in-line). Here I am not able to see any settings for the columns of the detail from the Grid.

Attached the screenshot of the Detail Grid where the Order number is the lookup field referring an object.

 

Any suggestions is really helpful.

Show all comments

Dear,

 

We want to refresh a Freedom UI page from a business process.

This process is triggered when a field has been modified and will do some calculations.

After that, the page should be refreshed.

 

In Classic UI, there was an add-on in the Marketplace of it could be fixed with sending a message from a script task which was processed by a method in the javascript page.

 

Is this still an option in Freedom UI? Or is there another solution?

 

Kind regards,

Vincent

Like 0

Like

1 comments

Hello, 

You can see how to do this for a Freedom UI page here 

https://customerfx.com/article/receiving-server-side-messages-in-a-crea…

That article shows how to receive the message, the article links to another article that shows how to send the message from the process. As for refreshing the page once you get the message, see https://customerfx.com/article/refreshing-reloading-page-or-list-data-o…

Also, just to point out, this sort of thing won't be necessary in 8.0.7, which is due out soon. There will be a built in way where you can set an option in the object for it to auto refresh called "Enable live data update". Checking this will handle the sending of the message and refreshing any UI bound to the object automatically when the object is modified in processes etc.

Ryan

Show all comments

Hello, 

 

I am able to read a single record using Model class that helps me alot. 

For reading a collection I am using ESQ, but I wanted to use Model class which simplifies my work.

Is it possible to read a collection of records using Model class?

 

Like 0

Like

3 comments

Hello,



Could you please clarify what you mean by "Model class"? Also, could you kindly provide us with an example of how you read a record?



Thank you.

For Orkhan: The model class is the new method for working with data objects in Freedom UI pages, available in the DevKit SDK, replacing EntitySchemaQuery, InsertQuery, UpdateQuery, and DeleteQuery. An example of reading a record using the Model class is here https://customerfx.com/article/retrieving-a-record-via-the-model-class-…

 

However there are issues currently when reading a collection of records since the filters are not properly set. I have an open case with support on this topic (case #SR-01182879). When filters are used with the model load it sets the filters incorrectly and causes a server error. I have an article ready to publish on this topic as soon as the issue is resolved but I’ve not heard anything from support yet. 

The code to load a collection of records using the model class would look something like this (however, as I mentioned, the filter gets applied incorrectly and the query fails with a server error 500 due to the invalid filter)

const accountModel = await sdk.Model.create("Account");
 
const filters = new sdk.FilterGroup();
await filters.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Type.Name", "Partner");
 
const partners = await accountModel.load({
    attributes: ["Id", "Name", "Type"],
    parameters: [{
        type: sdk.ModelParameterType.Filter,
        value: filters
    }]
});



Ryan

Also, I do have a workaround for the issue with querying a collection of records using the Model class. The issue that occurs is with how the filters are serialized to JSON for the request. However, if you shallow copy the filters first, then replace the filter.items, it will work. Here is a sample with this workaround (this does work successfully):

const accountModel = await sdk.Model.create("Account");
 
// create the filters
const filters = new sdk.FilterGroup();
await filters.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Type.Name", "Partner");
 
// shallow copy the filters to a new object and replace the items
const newFilters = Object.assign({}, filters);
newFilters.items = filters.items;
 
const accounts = await accountModel.load({
    attributes: ["Id", "Name", "Type"],
    parameters: [{
        type: sdk.ModelParameterType.Filter,
        value: newFilters
    }]
});

Hopefully I'll hear back on why this only works with this workaround and this will no longer be necessary.

Ryan

Show all comments

Hello, 

 

I have a case to filter a lookup field based on the other lookup field value 

lets consider I have two lookup fields A and B and I have A1, A2 items in 'A' Lookup. 

I have B1, B2, B3, B4 in B lookup.

Now I wanted to filter B1 and B2 from lookup 'B' If i have chosen A1from A lookup.

and B3, B4 If I have chosen A2 from A lookup  

I tried using crt.LoadDataRequest in crt.HandleViewModelAttributeChangeRequest handler on change of A lookup. But it could not find the datasource of the lookup B on changing Lookup A, and it could not able to filter the lookup even in page load.

Any suggestions are really helpful.

 

Thanks

Gargeyi

 

 

Like 0

Like

2 comments

HI Team, 

 

How we can use iframe in the new Freedom UI? There is some code we can add?

Thanks, 

 

Like 1

Like

6 comments
Best reply

Federico Buffa ?, Damien Collot, 

It's possible to do that with the help of this article:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

In the 1.2.ii. "Declare the component class", you should insert your iframe HTML markup.

 

Also, keep in mind that not all sites can be inserted as iframes due to different security settings.

 

We have plans to implement a no-code component in future releases. Thank you for your feedback about this.

Hello Federico, 

 

Please let us know if you have tried to implement the functionality as described in our Academy?

If there were any errors or difficulties, please let us know which exactly?

https://academy.creatio.com/docs/developer/interface_elements/record_pa…

 

Best regards,

Anastasiia

Anastasiia Zhuravel,

Yes this seams to work only for the classic UI no for the Freedom. I need a solution for the new UI

Same, Client wanted something similar for an integration with an external application. Was looking forward to more advanced capabilities in Freedom UI

Hello,

 

It seems that IFRAMECONTROL view type is not supported in Freedom UI and also we don't have any example of this implementation internaly. I've asked our core R&D team to add this possibility in the out-of-the-box configuration and provide some examples in the Academy. Thank you for this idea and helping in making the app better!

Oleg Drobina,

Looks is something very needed for the clients :)

Federico Buffa ?, Damien Collot, 

It's possible to do that with the help of this article:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

In the 1.2.ii. "Declare the component class", you should insert your iframe HTML markup.

 

Also, keep in mind that not all sites can be inserted as iframes due to different security settings.

 

We have plans to implement a no-code component in future releases. Thank you for your feedback about this.

Show all comments

Hello Community, 

 

I wanted to refresh the detail in a form page after adding/updating a detail.

Here all the fields in the detail is added/updated in a separate page. On click of save button, the record gets added/updated. But I wanted to refresh entire detail.

 

Thanks

Like 0

Like

3 comments

Hello, 



Please check the discussion regarding your question here.

Bogdan,

Hello Bogdan, 

 

Thank you for your response.

But I wanted to reload the detail in Freedom UI, the detail is in the form page and on click of '+' we add the new details which is in other form

 

Once I save the details the page automatically moves the parent form page. But the detail is not refreshed, Only the record gets added to the detail.

 

I wanted to refresh entire detail after click of Save while saving a new record in child form.

 

const handlerChain = sdk.HandlerChainService.instance;

                             await handlerChain.process({

                            type: "crt.LoadDataRequest",

                            $context: request.$context,

                            config: {

                                loadType: "reload"

                            },

                            dataSourceName: "datasourcename"

                        });

 

This works in the current form page. But i wanted to refresh the detail in parent form page once I click on save button in child form page.

 

GargeyiGnanasekhar,

 

Unfortunately, we don't have ready examples of the implementation of your business task.

 

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

 

Thank you for helping us to improve our product. 

Show all comments

Hi, 

 

I have a business case to update a field in a detail in other records and then delete the selected record from a detail after clicking "Yes" from the confirmation box.

As of now field is updated to all records on click of delete button in a detail. 

{  

            request: "crt.DeleteRecordRequest",

            handler: async (request, next) => {

             await next?.handle(request); 

           console.log("Deleting a record in detail"); 

//to validate if I clicked Yes or No from the confirmation box 

}

 

Any suggestions is really helpful.

 

File attachments
Like 0

Like

4 comments

Hi,

 

Please use a business process in this case to read all remaining records from the detail and update their values that will be triggered upon record deletion from the object of this detail. It's much easier than trying to create a UI logic using DeleteRecordReqeust.

Oleg Drobina,

Hello Oleg, 

 

I have almost implemented functionality in the client schema under deleteRecordRequest handler. Right now the functionality is working irrespective of the confirmation option choosen, It works even when we click No from the confirmation box. 

 

I wanted to make the functionality to work only if I click "Yes" from the confirmation box. 

 

Is it possible to read the option chosen by user while deleting a record(either Yes or No) in the handler?

 

Thanks

 

 

GargeyiGnanasekhar,

 

What I've observed from the behavior is that the DeleteRecordRequest is called twice: once you click delete button and once you select one of the yes\no options. Then I was trying to find a difference in either requests contexts or in the requests, but there is none or it's not obvious. And finally if we take a look at the initiator of the GetCanDelete method (that is called once you hit the "Yes" option) it's also not obvious who calls it:

I really tried to find a place in the code that could be overriden, but it seems that it's impossible to do in the current version (tested in 8.0.6). That's why I've asked to use a business process instead.

If you want to initiate the delete from your own code, you can use the Model class for that. See https://customerfx.com/article/deleting-a-record-from-client-side-code-…

If you're handling the crt.DeleteRecordsRequest you could simply not call the "next" handler in the chain. Basically, only call this if the answer is yes: await next?.handle(request); 

Ryan

Show all comments

Hello Community, 

 

I wanted to save a record in form page on click of save button and wanted stay in the form page. 

currently on click of button, my page saves the record and then navigates to list page from form page automatically.

Any suggestions is really helpful.

 

Thanks

Gargeyi.G

Like 0

Like

3 comments

Hello, 

See this article https://customerfx.com/article/prevent-navigating-back-to-a-parent-page…

There's an isSilent param in the page config you can change to prevent it from closing.

Ryan

Ryan Farley,

I am not sure this works when using the 'New Order' (from Opportunity) process. It appears to Save the record and keep you on the page but when you select Close or add a section detail to the page it still takes you all the way back to the original Opportunity Page. Is there a way round this?

Gargeyi.G thank for ur question. Ryan Farley thank u for ur answer this is what i needed

Show all comments

Hello Community, 

 

I wanted to perform two actions on click of a button

1. Saves the fields in the tab page 

2. Navigate to next tab 

Right now we are using the crt.SaveRecordRequest. This only saves the page. 

 

Any suggestions is really helpful 

 

Thanks

Gargeyi.G

Like 0

Like

4 comments

Hello,

This article will show you how to navigate to a new page on a Freedom UI page: 

https://customerfx.com/article/navigating-to-a-page-via-code-in-a-creat…

If you want to open an edit page for a record, or an add page, this article outlines how to do that: 

https://customerfx.com/article/opening-an-edit-page-to-add-or-edit-a-re…

Ryan

Also, as far as having the button trigger both - there are two routes you can take. 

Route 1 - If you'd always go to this other page after saving, you could just do that when the save request is triggered. This article shows how to listen for when the page is saved, then you could navigate to the other page from there: https://customerfx.com/article/adding-code-to-the-save-event-of-a-creat…

Route 2 - If you're only wanting to save, then go to this other page, when your own button is clicked, and not for all saves, then you can wire up your own handler for your button. This article shows how to to that: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o… In the handler, you'd save the page, then navigate to the other page. If you go this route (creating a custom request for your button). It would look like this:

{
	request: "cfx.clickMeButtonClicked",
	handler: async (request, next) => {
		// make sure you've added the "@creatio-devkit/common" as mentioned in the articles			
		const handlerChain = sdk.HandlerChainService.instance;
 
		// first save the record
		await handlerChain.process({
			type: "crt.SaveRecordRequest",
			$context: request.$context
		});
 
		// now navigate to the other page, this navigates to the orders section
		await handlerChain.process({
			type: "crt.OpenPageRequest",
			schemaName: "OrderSectionV2",
			$context: request.$context
		});
 
		return await next?.handle(request);
	}
}

Ryan

Ryan Farley,

Please note that it's best to pass context to each handlerChain.process call. So, in your example, the second call should be:

		// now navigate to the other page, this navigates to the orders section
		await handlerChain.process({
			type: "crt.OpenPageRequest",
			schemaName: "OrderSectionV2",
			$context: request.$context
		});

 

Oleksandr Khardikov,

Thanks for that. I've updated the code in my reply for completeness and also the articles on my website.

Ryan

Show all comments