I know we can define custom blocks (not exactly how but I think it is in the docs). But can I register an event during the installation of one module, that handles a special save action when a record of another module (where the custom block is in) is saved? So basically catch the $_REQUEST global and pick out the fields from my custom block?
Thread Rating:
Save the information on custom blocks
|
12-03-2016, 12:55 PM
all events are global, they get called everytime the event happens.
that means that if you register an aftersave event, your handler will be called on ALL the saves in the application. that is why you normally "protect" your handler with something like: if (module is my module).... in this case your condition will check for both conditions: if (module is the one that has the custom block and I have information to do something with my module)....
Joe
TSolucio
12-03-2016, 12:59 PM
Nice! So in my case (I want to make a block in salesorders), I would check for the aftersave event, make sure it was a salesorder and as long as I use named, hidden input fields I can use the $_REQUEST global right? Only thing is, will I also have the CRM ID of the salesorder that just saved?
12-03-2016, 01:04 PM
Correct.
Yes, you have all the information of the record being saved and the $_REQUEST array. It is the parameter https://github.com/tsolucio/corebos/blob/master/modules/HelpDesk/HelpDeskHandler.php#L31
Joe
TSolucio
12-03-2016, 01:39 PM
Nice! This is perfect for what I have in mind.
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 3 Guest(s)