Hi community..

 

I'm using a marketplace add-on, and want to customize one of their page.

In that page, there is a button that implement a custom handler. And how to modify/override that custom handler in my custom package?

For that page i have make it available in my custom package, but when i switch to code (client schema) i didn't find that handler.

Is it possible?

Like 0

Like

6 comments

You won't see the handler in your replacing page, however, you can still override it. For example, if the base page has a request called this: 

{
	request: "usr.MyCustomRequest",
	handler: async (request, next) => {
		// code is here
 
		return request?.handle(next);
	}
}

In your code in the replacing page, you could add:

{
	request: "usr.MyCustomRequest",
	handler: async (request, next) => {
		// YOUR code here, as needed
 
		// the line below calls the base page's handler
		return request?.handle(next);
	}
}

If you don't want the base page's handler to run, just omit the line below in your code:

return request?.handle(next);

Then with that line gone in your handler in the replacing page, the base page's handler won't run at all since it won't get called. If you still want it to run, but then your code does other stuff after it is done, you could do this: 

{
	request: "usr.MyCustomRequest",
	handler: async (request, next) => {
		// let base page handler run first
		const result = await request?.handle(next);
 
		// now do your stuff
 
		return result;
	}
}

Hopefully, that makes sense.

Ryan

Hi Ryan,


Thanks for the response..

 

I tried that and the good news is I can change the handler (it works), but the parent handler is still called 🥲

 

{
handlers: /**SCHEMA_HANDLERS*/[{
				request: "crt.CloseChatRequest",
				handler: async (request, next) => {
					const chatId = request.recordId;
					const category = request.category;
					let categoryId;
 
					console.log({chatId, category,categoryId});
 
					// return request?.handle(next);
				}	
		}]/**SCHEMA_HANDLERS*/
}

 

As you can see, it is related to closing the chat. 

In my code, I do nothing except just to console log. 

The expectation is that the chat session is not closed, but the result is that it is still closed.

 

Am I missing something?

Cokky Saut Monang Turnip,

Hmm. Try returning false? (instead of just commenting out the return request.handle(next))

In order to customize a page from a marketplace add-on and override a custom handler in your custom package you can do the following:

  1. Create a new client schema in your custom package (e.g., CustomPageSchema).
  2. Extend the existing schema and override the handler:
define("CustomPageSchema", ["OriginalPageSchema"], function() {
    return {
        entitySchemaName: "YourEntitySchemaName",
        attributes: {},
        diff: [],
        methods: {
            // Override the custom handler
            onButtonClick: function() {
                // Your custom logic here
                console.log("Custom handler logic");
 
                // Optionally, call the base method if needed
                this.callParent(arguments);
            }
        }
    };
});
  1. Register the custom schema in the CustomPageSchema schema.

After that deploy your changes and test.

 

Also if you don't want to create a new schema you can try to update the existing one.

     1. Add new handler method in the method section:

 

methods: {
	onButtonClick: function() {  }
}

     
2.Bind the new method to "click" event of the corresponding   button

 

   diff: /**SCHEMA_DIFF*/[
	{
		"operation": "insert",
		"name": "YourButton",
		"values": {
		"itemType": 5,
		"caption": {
			"bindTo": "Resources.Strings.YourButtonCaption"
		},
		"click": {
			"bindTo": "onButtonClick"
		},
		...
	}
		...
]


 

Also you can find some useful information in this article

https://customerfx.com/article/overriding-modules-in-creatio-formerly-b…

Iryna Oriyenko,

That applies to classic pages (and modules) only, not Freedom UI page handlers.

Ryan Farley,

Negative.. the result is still same 🥲🥲

 

I have tried :

  • - return true;
  • - return false;
  • - comment out the 'return request?.handle(next);'

 

any clue??

Show all comments

Can anyone tell me what are the events that we can use to trigger a handler code other than "clicked" on a button? for example hover-over, dropdown clicked, etc.?

Please specify the events that are already supported by creatio or if they require some customization to make them work.

Like 0

Like

1 comments

Hello Ahmad,

There is no such official documentation. Each business task needs to be reviewed separately to find the perfect solution. 

As I understood from the question described, you may use dataSources to cover your task. Please check the article to find out more.

Additionally, you may read here about the Creatio front-end architecture. 

 

Show all comments

Good day, colleagues!

Please help me understand the issue. On the OpportunitySection (and similarly on the LeadSection ), the system does not allow any changes to be made, not even adding a simple comment. I'm making changes to the schema that was automatically created when modifying in the section wizard. It's in my own package.

23505: duplicate key value violates unique constraint "IUSysSchemaUIdSysPackageId"



 

Like 1

Like

5 comments
Best reply

I get that in recent versions when I create a package and then set that as the current package. Once I log out and back in again the issue goes away (assuming that what you're getting is the same issue that I've experienced). Have you logged out and back in again since creating the package?

Ryan

I get that in recent versions when I create a package and then set that as the current package. Once I log out and back in again the issue goes away (assuming that what you're getting is the same issue that I've experienced). Have you logged out and back in again since creating the package?

Ryan

Ryan Farley,

The package was created a long time ago, but your advice helped me :)) That's strange. Thank you very much!

Hi! 

I'm getting the same message when I try to save a new Entity. Do we have an update on the possible cause of the issue?



Thanks,

Ignacio.

I had this error recently, except for it was within the business process table. It was trying to save another record with an empty Guid (one existed already). 



Couldn't get an answer on how this happened. My belief was that when you copy a business process, it creates an empty record whilst at the same time, my browser was not allowing the copied business process to open in the new tab. (only logical reason I could think of)



I would check the values in the table you mentioned to see where there is a duplicate key and then delete one of them. 

Same issue here. Someone has this resolve?

Show all comments