Action

Predefined action

Arguments

$action
Id or name of the action

Example

Print order bill:

$this->get('action','order_bill')->setPage($Order)->execute();

execute()

Run action with given parameters. Page->getAction() and Pages->getAction() creates new action and sets the page(s) calling it:

$OrderPage->getAction('send_order')
    ->setParameters(Array(
        'message'=>'Here is your order'
    ))->execute();

executeAsync()

Run action in background after 10 sec delay.

$OrderPage->getAction('send_order')->executeAsync(10);
Run action with custom settings:
page_id
user_id
delay
my_variable

Set parameters and additional execute settings:

$OrderPage->getAction('send_order')
    ->setParameters(Array(
      'message' => 'Here is your order'
    ))
    ->executeAsync(Array(
      'delay' => 10,
      'COPY_TO_SENDER' => true
    ));

// In executed script:
// $_GET[COPY_TO_SENDER] === true
// $this->getParameter('message') === 'Here is your order'

PDF -file

Get PDF -file

$Pdf = $Order->getAction('order_confirmation')->getPdf();

Save file to tiedosto -field

$Client->order_confirmations->addValue(Array(
   'filename' => $Pdf->getFilename(),
   'content' => $Pdf->getContent()
));

Save to file

$Pdf->saveToFile($filename);

Email and SMS

Send 'Order confirmation' -mail:

$this->get('action','order_confirmation_mail')->send($Order);

Or get email from $Order Page::getAction() -class:

$OrderPage->getAction('order_confirmation_mail')->send();

Modify email created by action before sending it:

$this->get('action','order_confirmation_mail')
    ->getMail($sivu)
    ->setTo('my.name@email.com')
    ->send($Order);

Webservice

If you have an integration -action that uses Action Webservice -object, you can get information of the request after it is executed:

$Webservice = $Action->getWebservice();
if ( $Webservice->getSuccess() ){
    $response = $Webservice->getResponse();
}
else {
    $messages = $Webservice->getMessages(); // All messages
}

Full method list

Method Return Description
setPage(var) this Set page(s) to be used inside action: Pages, Page, array of Page, int.
setParameters(array) this Set additional variables
getParameters() array Get additional variables
getParameter(name[,default]) mixed Get additional variable. You can get subvalue using slash: 'employee/title' --> employee['title']. If not set, return default (version 2025.1)
getPreferences() array Get action preferences
getPreference(name) array Get action preferences. You can get subvalue using slash.
execute() Run action -specific action.
executeAsync([settings]) Run action in background.
send([page,param]) Send email. Override values with values in param array.
getLink() eLink Return eLink object with pages set in action.
getWebservice() ActionWebservice Integration -action: Return action Webservice object.
getPdf() ActionPdf Print -action: Return action PDF object.
getMail([page]) eMail Mail -action: Return eMail object with data defined in action.
getSms([page]) eSms Sms action: Return eSms -object with data defined in action.
getUrl([valid=7]) string Return url to public page

DEPRECATED

Use

$Action->setPage($Page)->execute();

instead of

$Action->runAction($Page);

Methods