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