Layout element "Button"

There is a layout element “Button” in the class editor:

You can execute a piece of JavaScript when you click on the button.

My question is: Is it possible to get the object ID or another object property with JavaScript?

image

The goal is: Click on the button:

(function() { window.location.href = '/showsomething_' + this->**getOoId**; } )

An after the click you will be redirected to /showsomething_5408’

So is there a method like this->getOoId (pseudo-code) to get the actual object ID?

thx
Markus

It took a while, but i found the solution by myself :slight_smile:

Sample code, when you click on the button:

(function() {
			var o_id = this.object.data.general.o_id;
			var link = 'http://www.myhost.com/exportdatasheet_de_' + o_id + '_34';
window.open(link);

}

Much more easy than to integrate a button in the toolbar

1 Like