Время создания
Filters

Hi

 

Somebody know how determine, when working with a record in a Freedom UI page if it corresponds to a new record (new/copy)?

 

Thanks in advance

 

Regards

 

Julio Falcón

Like 0

Like

5 comments

Hello Julio,

const cardState = await request.$context.CardState;
if (cardState == "add" || cardState == "copy") {
     // do something here
}

Ryan

Ryan Farley,

Thanks Ryan, where did you find/get this kind of information?

Ryan Farley,

Ryan,

 

In which kind of handler request I must introduce the code? I tried in crt.OpenPageRequest, but nothing happens. The code I'm using:

 

handlers: /**SCHEMA_HANDLERS*/[ // NdosEntity_4ad7b54DS.NdosPeriodicidadMP
	{ 
		request: "crt.OpenPageRequest",
		handler: async (request, next) => {
			const okBtn = {
				key: "OK",
				config: {
					color: "accent",
					caption: "OK"
				}
			};
 
			const cancelBtn = {
				key: "CANCEL",
				config: {
					color: "primary",
					caption: "Salir"
				}
			};
 
			// Nuevo o Copia
			const cardState = await request.$context.CardState;
 
			// Mensaje...
			const result = await request.$context.executeRequest({
				type: "crt.ShowDialogRequest",
				$context: request.$context,
				dialogConfig: {
					data: {
						message: ( cardState == "add" || cardState == "copy" ) ? "New: Este es un nuevo registro" : "Existing one: Este registro ya existe" ,
						actions: [ okBtn, cancelBtn ]
					}
				}
			});
 
			if (result === "OK") {
				// Clica en OK
 
			}
 
			/* Siguiente handler, retorna resultado */
			return next?.handle( request );
 
		},	
	},
]

Julio.Falcon_Nodos,

You would add this in the page you’re opening, not in the code that opens the page. What is the intent you’re trying to produce? I assume that in a page you’re wanting to know if the page is in add mode vs edit. Correct? To accomplish this you’d add something such as a crt.HandleViewModelResumeRequest on the page and check the cardstate there. 

Thanks Ryan, I'm also try using crt.HandleViewModelResumeRequest, but nothnig happens.

 

What I need is that when I open the page "Air Equipment/NdosPage_3ud8c3e" it can detect if I am working with a new record and do something. So it is in the code of this page, where I enter the commented code, compile, open an existing record and create a new one and the code entered does not execute/does not work in any situation.

 

If I add the code inside a crt.HandleViewModelAttributeChangeRequest, it works, but it stays 

in loop and to exit I have to go back in the browser.

 

I made a short video to show what I'm doing and where the code is in case it helps to understand, see at

https://share.vidyard.com/watch/NRBjhx3hjzCi9sZ2x5qsSK?

 

In Classic UI I've the onEntityInitialized method to execute when open the page, but in Freedom is very different

 

Thanks again

Julñio

Show all comments

Greetings Community,

 

     Could someone provide me with references for Script Task queries related to CRUD operations on Creatio objects?

 

      Are there any examples or references available for sample scripts and C# functions regarding the Script Task element suitable for beginners?

Like 0

Like

2 comments

Hello,

 

As the first step, we recommend you to check our Academy article on Script Task process element that includes both instructions and examples of working with it. You can also use Academy and Community for searching examples of implementation of some more specific requests using the key words.

https://academy.creatio.com/docs/8.x/no-code-customization/bpm-tools/pr…

Hello Mira,

 

Thank you for your reply. I have reviewed the Academy article on the Script Task Process element. Also, executed on Creatio platform.

 

I am now interested in learning more about what we can accomplish with the Script Task element. Is there any additional information or examples available for Script element? 

 

regards, 

Ajay

Show all comments

Hi,

Is there a way to get the process log id generated by the current running business process?
I want to know what is the process log id while the business process is running.

Like 0

Like

0 comments
Show all comments

For instance, I've crafted a function to generate a contact:

 

void InsertContact(string contactName) {
   UserConnection userConnection = Get("UserConnection");

   contactName = contactName ?? "Unknown contact";


   var ins = new Insert(userConnection)
       .Into("Contact")
       .Set("Name", Column.Parameter(contactName))
       .Set("JobTitle", Column.Parameter("Consultant"))
       .Set("Notes", Column.Parameter("C# Script Test"));

 

   var affectedRows = ins.Execute();
}

 

However, I desire the function to be more versatile:

void InsertObject(string contactName, string ObjectName, var Object) {


   UserConnection userConnection = Get("UserConnection");

 

   // Generate a query dynamically using Object Name, Contact Object Columns, and Values

   var ins = new Insert(userConnection)
       .Into(ObjectName)
       .Set(Object["key"], Column.Parameter(Object["value"]));

 

   var affectedRows = ins.Execute();
}

This enhanced function can be dynamically utilized within the Script Element.

 

Is it possible to create the dynamic functions in Creatio like this?

 

Like 0

Like

1 comments

Hello, Ajay!

You can implement any logic with the code in the Creatio configuration, and any realization in C# is supported. Your code example looks logical and you can add it to the script task in business process, for example. 
More information about Script tasks:

https://academy.creatio.com/docs/8.x/no-code-customization/bpm-tools/process-elements-reference/system-actions/script-task-process-element

Back-end (C#) development basics:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/architecture/development-in-creatio/back-end-c-sharp

Also, you can register a background operation by following this article and use it in any part of application:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/back-end-development/data-operations-back-end/execute-operations-in-the-background/examples/register-a-background-operation

Show all comments

Hello,

 

Does Creatio have any implemented logic for versioning the files? I see that the base File object has a "Version" column that is always set to 1, it seems. Can this behaviour be changed? 

 

Thank you!

Like 0

Like

0 comments
Show all comments