Hello All, 

 

I have created code to load Custom Page. How i can add the await in Creatio Client Module function to read Object Data

 

Code Sample : 

define("UsrCustomFunction", [], async functio(){
                
       // API call Terrasoft.EntitySchemaQuery, to read the creatio table.
       var getProcessData = function(){

              var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                      rootSchemaName: "UsrGUMUProcessList"
              });

              esq.addColumn("Id");
              esq.addColumn("UsrName");


              return new Promise(function(resolve, reject) {
                     esq.getEntityCollection(function(response) {
                     if (response.success) {
                             resolve(response.collection);
                      } else {
                             reject(new Error("Failed to retrieve data: " + response.errorInfo.message));
                      }
               }, this);
             });

           }

 

             // [ Is it possible to add await or any other solution available for this? ]
             var processData = await getProcessData(); 
            
             //Process and return the Config based on the processData.
             return {
                 viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/
             };

});

 

 

Is this good solution to Create Custom Page in Creatio or any other solutions are available, then please assist me.

 

Regards,

Ajay K

 

Like 1

Like

1 comments

Hello Ajay,

Thank you for your question.

I suggest you to change your approach. You can override a default crt.HandleViewModelInitRequest  handler that is called before a page is fully rendered. There you might want to put your API call and depending on the result open a specific page. 

Here is a code snippet on how this might lookcode
In this case you also need to add @creatio-devkit/common dependency to schema dependenciescode

It is not recommended to dynamically modify entire schema configuration. Thus a better solution in your case could be binding your API call response to page element properties such as "visible" or "enabled".

Some helpful articles on the Academy: 
1. Generic handlers.
2. Open a Freedom UI page from a handler

Hope this helps and let me know if you have any questions left!
 

Show all comments

Hi.

 

I have a business process with a file collection input parameter:

 

 

I am trying to run this process and pass the file collection to it inside a client module of a page, like so:

 

const selectedRowsfirstGrid = request.$context.DataGrid_264vdyg_SelectedRows.__zone_symbol__value;
const selectedRowsSecondGrid = request.$context.DataGrid_c581cyj_SelectedRows.__zone_symbol__value;
 const ids = [...selectedRowsfirstGrid, ...selectedRowsSecondGrid];
 const FilesIdCollection = [];
               
 for(const fileId of ids) {
     FilesIdCollection.push({ FileId: fileId });
 }

 

const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
    type: "crt.RunBusinessProcessRequest",
    processName: "QsProcess_Attach_files_to_the_email",
    processParameters: {
        FilesIdCollection: FilesIdCollection
     },
     $context: request.$context
});

 

I want to mention the fact that the code successfully runs the process if I omit the "processParameters" property, so that's most likely the cause of the error, but I just cannot find what's wrong with it. I looked at the names (code names, not display names), I searched the creatio community a bunch and I just cannot figure it out.

 

Edit: I tried the same code but passed a Guid parameter instead, with a randomly generated Guid and it all works smoothly; the problem seems to be that the collection I am creating is not compatible with the File Collection type from the business process, but how do I make them compatible?

 

Thank you in advance for your help!

Laurentiu

Like 1

Like

2 comments
Best reply

Hello Laurentiu,
Thanks for your question!

As far as i am aware of passing the file from the client side is not supported in Creatio.

However, i tried to implement similar logic to one that you provided. I created a section with attachments and a button which upon clicking executes a business process and passes there a parameter with id's of all selected items in the list page. If the array is empty (i.e no records are selected), the process does not start at all. Then in business process we loop through each account and save the account attachments into an external object (specially created for the process). After the loop, we read all the saved files, attach them to an email, and send the email. Then, i delete the attachments from the special object.

The special object i am referring to is an object that is created in Configurations. I used it as a "buffer" object and it does not contain any useful information.

Here is an example of this implementation: 
list page handler for bp

1

2
 

3

5
611


Hope this helps.
Let me know if you have any question left.

 

Hello Laurentiu,
Thanks for your question!

As far as i am aware of passing the file from the client side is not supported in Creatio.

However, i tried to implement similar logic to one that you provided. I created a section with attachments and a button which upon clicking executes a business process and passes there a parameter with id's of all selected items in the list page. If the array is empty (i.e no records are selected), the process does not start at all. Then in business process we loop through each account and save the account attachments into an external object (specially created for the process). After the loop, we read all the saved files, attach them to an email, and send the email. Then, i delete the attachments from the special object.

The special object i am referring to is an object that is created in Configurations. I used it as a "buffer" object and it does not contain any useful information.

Here is an example of this implementation: 
list page handler for bp

1

2
 

3

5
611


Hope this helps.
Let me know if you have any question left.

 

Hi Yevhenii, thank you so much for your response!

I am currently struggling to understand/replicate how you set up the "Record to store the files in". I created a separate object with an Id and another Guid field. However, when trying to set the value for the field you labeled as "Record to store the files in", I don't see any viable option that resembles your implementation.

 

3

 

Could you please elaborate on the structure of your custom object, and how you came to that value inside the "Record to store the files in" field?

 

Thanks so much again!

Laurentiu

Show all comments

Hello Community,

 

I want to Create the Custom Page as shown in Image where, I can List the Custom UI Card Based on the Table Rows of Creatio. also I want to run the particular Process of the Creatio on click of the Button.

 

Give me any reference for this, if available.

 

Regards,

Ajay K

 

Like 0

Like

1 comments

Dear colleagues,

 

Any idea how to apply bussiness rules to an editable detail grid schema? just by code?

 

Is very usefull can edit in the grid, but just when have no rules, no read only fields, no filters, no calculated fields and so on.

 

Any ideas?

 

Thanks

 

Regrads

Julio

Like 0

Like

1 comments
Best reply

If i'm not wrong i guess you mean to say you have a inline editable detail without any form page for the user to add details and you want to add some kind of business rules.
You can add them in the object level.


But if you have a form page for the detail,you can do it through code by using handlers.
https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…
 

If i'm not wrong i guess you mean to say you have a inline editable detail without any form page for the user to add details and you want to add some kind of business rules.
You can add them in the object level.


But if you have a form page for the detail,you can do it through code by using handlers.
https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…
 

Show all comments

Hi Community,

Can you provide a code example for the following scenario:

When a record to a detail is added, make a field in the Parent Page visible.

Example

When a record is created in Detail 'Opportunity Team' make the Description field (of Opportunity_Form_Page) visible

Regards

Sasor

Like 0

Like

2 comments
Best reply

Hey,
So you can  fetch the count of records under the detail object through code.If the count is greater than 0 then you can make it visibile.
EG below:

for the visibilty logic refer - https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…


 

Hi Community,

Any update regarding scenario?

Sasori

Hey,
So you can  fetch the count of records under the detail object through code.If the count is greater than 0 then you can make it visibile.
EG below:

for the visibilty logic refer - https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…


 

Show all comments

Hi Community,

Can you provide a code snippet of how we can capture the delete event generated from an Editable List, from the parent Page?

Example:

 

We want to catch in the Opportunities_FormPage -> the deletion of a record in Opportunity Team Detail.

Regards,

Sasor

Like 0

Like

3 comments

Hi Community,

Any update regarding this scenario?

Sasori

Sasori,

You can fetch the event of deletion in a business process. Then you can do actions and if your object opportunity has live update set then the updates will appear as soon the business process has run.

 

Other option would be to add your own action in the list and handle all necessary changes in the page.

 

Franck

Hello!

There is a crt.DeleteRecordsRequest, you can add a custom handler for this request (handlers in schema metadata).

This request is called when the user tries to delete records from the row menu and bulk actions menu.
But it is called before user confirmation (modal window), and rights checking.

There are such properties in the payload: 

dataSourceName - data source name of list, for which request is called;
filters - filters for records deletion(passed when records deleted by bulk actions panel)

recordIds - record ids which should be deleted (passed when record deleted by clicking row menu delete button)

Example:


handlers: /**SCHEMA_HANDLERS*/[{
            request: "crt.DeleteRecordsRequest",
            handler: async (request, next) => {
                const dataSourceName = request.dataSourceName;
                const filters = request.filters;
                const recordIds = request.recordIds ;


                console.log(dataSourceName, filters, recordIds );
                return next?.handle(request);
            }
}]/**SCHEMA_HANDLERS*/,

Show all comments

is there a way to rename the "Save"  button on a record page ?

regards, 

Like 1

Like

4 comments
Best reply

I assume you're referring to the caption? You can change the caption for the button by opening the edit page schema (for example, AccountPageV2) and find the localizable string (on the left side) "SaveButtonCaption" then give it a new value.

Ryan

I assume you're referring to the caption? You can change the caption for the button by opening the edit page schema (for example, AccountPageV2) and find the localizable string (on the left side) "SaveButtonCaption" then give it a new value.

Ryan

Ryan Farley,

Thanks Ryan, that worked when creating a new record. When I click New to add a new record the save button became Submit, but when editing the existing record the button appeared to be "Save" again. How to make it Submit on adding and editing a record.

Thanks in advance

You also need to change the "SaveRecordButtonCaption" string in the associated section (such as AccountSectionV2)

Ryan Farley,

Worked ! Many thanks Ryan. 

Show all comments

Hi

 

Somebody tried to enable Playbook areticles in a Freedom UI DCM's?

 

I tried, but they didn't appears

 

Some trick?

 

Thanks

Julio Falcón

Like 0

Like

2 comments
Best reply

Ryan Farley,

Thanks Ryan, I saw that it is a new component, I was looking for it in the DCM, as in Classic UI. :-)

Show all comments

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

7 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

Julio.Falcon_Nodos,

Hello Julio,

Does it also not enter the handler if you try adding a "crt.HandleViewModelInitRequest"?

Ryan Farley,

No Ryan, I didn't understand what's wrong with my code :-(, 

 

Show all comments

Dear collegaues

 

In Classic UI, I need to add a Filter business rule to can get only contacts with Email is completed. Some ideas how to solve this?

 

I tried not equal "", not contains "@" and others and didn't works

 

Thanks in advance

 

Regards

Julio

Like 0

Like

2 comments
Best reply


Hello,
 

Unfortunately, it's not possible to add such a filter using basic filters. However, you can write a custom filter in the schema code.

For example, for the Owner field on the AccountPageV2 schema, this filter may look like this:


define("AccountPageV2", [], function() {
   return {
       "entitySchemaName": "Account",
       "attributes": {
           "Owner": {
               "dataValueType": Terrasoft.DataValueType.LOOKUP,
               "lookupListConfig": {
                   "filters": [
                       function() {
                           var filterGroup = Ext.create("Terrasoft.FilterGroup");

                           filterGroup.add("HasEmail",
                               Terrasoft.createColumnFilterWithParameter(
                                   Terrasoft.ComparisonType.NOT_EQUAL,
                                   "Email",
                                   ""));
                           return filterGroup;
                       }
                   ]
               }
           }
       }
   };
});

This filter ensures that only contacts with the Email field not equal to empty string will be included in the selection for the Owner field.
 

You can learn more about such filtering in our academy: Link

Thank you for reaching out!


Hello,
 

Unfortunately, it's not possible to add such a filter using basic filters. However, you can write a custom filter in the schema code.

For example, for the Owner field on the AccountPageV2 schema, this filter may look like this:


define("AccountPageV2", [], function() {
   return {
       "entitySchemaName": "Account",
       "attributes": {
           "Owner": {
               "dataValueType": Terrasoft.DataValueType.LOOKUP,
               "lookupListConfig": {
                   "filters": [
                       function() {
                           var filterGroup = Ext.create("Terrasoft.FilterGroup");

                           filterGroup.add("HasEmail",
                               Terrasoft.createColumnFilterWithParameter(
                                   Terrasoft.ComparisonType.NOT_EQUAL,
                                   "Email",
                                   ""));
                           return filterGroup;
                       }
                   ]
               }
           }
       }
   };
});

This filter ensures that only contacts with the Email field not equal to empty string will be included in the selection for the Owner field.
 

You can learn more about such filtering in our academy: Link

Thank you for reaching out!

Thanks Pavlo

Show all comments