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

Hello Community, 

 

How can we set the default value for a Datetime field to the tomorrow's date?

 

Thanks

Gargeyi.G

Like 0

Like

2 comments

I don't believe you can set a default for tomorrow's date in the object property defaults (unless you add it in the entity code). 

It's done pretty easily on the page if you want to add the code there, it would look like this (for a Freedom UI page):

handlers: /**SCHEMA_HANDLERS*/[
	{
		request: "crt.HandleViewModelInitRequest",
		handler: async (request, next) => {
			const result = await next?.handle(request);
 
			const cardState = await request.$context.CardState;
			if (cardState == "add" || cardState == "copy") {
				request.$context.TheDateFieldAttribute = Terrasoft.utils.date.addDays(new Date(), 1);
			}
 
			return result;
		}
	}
]/**SCHEMA_HANDLERS*/,

Ryan

Ryan Farley,

Thank you, it worked 

Show all comments

Hello Community, 

 

Is it possible to bind the title of the form page from "New Record"  to a field value on load of a page in freedom UI.

 

Thanks

Gargeyi.G

Like 0

Like

1 comments

Hello,

You can change that by adding a handler like this - note this will change the value from "New record" when adding a new record for the page:

handlers: /**SCHEMA_HANDLERS*/[
	{
		request: "crt.HandleViewModelInitRequest",
		handler: async (request, next) => {
			const result = await next?.handle(request);
 
			const cardState = await request.$context.CardState;
			if (cardState == "add" || cardState == "copy") {
				request.$context.HeaderCaption = "Add a new something";
			}
 
			return result;
		}
	}
]/**SCHEMA_HANDLERS*/,

As far as binding it to some page value, you could use the same but first get a value from the page. Something like this:

handlers: /**SCHEMA_HANDLERS*/[
	{
		request: "crt.HandleViewModelInitRequest",
		handler: async (request, next) => {
			const result = await next?.handle(request);
 
			const cardState = await request.$context.CardState;
			if (cardState == "add" || cardState == "copy") {
				request.$context.HeaderCaption = "Add a new something";
			}
			else {
				// get a value from the page
				const someValue = request.$context.someAttributeOnThePage;
				request.$context.HeaderCaption = someValue;
			}
 
			return result;
		}
	}
]/**SCHEMA_HANDLERS*/,

Ryan

Show all comments

Hello Community, 

 

I would like to know how we can add a new record in the editable detail in a form page without opening a new page on click of '+' icon in freedom UI. Now on click of '+' icon it opens a new page to add the record. 

 

Thanks

Gargeyi.G

 

 

Like 0

Like

1 comments

Hello!

 

As for now, this is the correct behavior of the system - there is a page opened and you have to fill the fields to have it added to the detail.

Our development team is already working on updating the application to implement the inline record adding. So hopefully, this functionality will be available in the nearest releases.

Thank you for this suggestion, this helps to make our product better!

 

Best regards,

Kate

Show all comments