Part Actions

Top  Previous  Next


Part actions allow you to set an action that will take place when saving an invoice that contains the relevant part, for example, you could set an action to update the vehicle's service due date whenever you save an invoice that has a labour item called 'Carry out full service'


Note, part actions can only be set on items (parts or labour) that have already been saved into the inventory.  To access the part actions screen navigate to :




You will then see the Parts Actions screen:




Press New Action and you will see:




All you need to do is select a part or labour by pressing the first or second button (the small green crosses) and then selecting the action that you want to happen.


Once you've set it all correctly press 'Ok'






When you next save a new invoice (or edit an old one) where you have added an item that has an action assigned to it you will see the following screen:




At this point you can see a list of action (one in this example) that are pending, you can untick those that you don't want to happen or dismiss them all by closing the window or pressing cancel.



Extended Part Action Scripts (V4.1.0.0 onwards)


Onyx comes with a few standard part actions, such as updating the mot or service dates, but if you want to do more than this you can create an extended part action script. Extended part action scripts allow you to create a script that runs when the part action runs. These scripts allow you to access most vehicle and client data fields (and user fields) and also details of the invoice.  So, for example, you could decide to update a customer vehicle user field that you have added to record when a cam belt was changed.


Example Extended Part Action Scripts


Below you will see how to create an extended part action script that is designed to update a vehicle user field.  It is an example and definitely not the only way to achieve the outcome.


To create the new extended part action press the 'Add' button (blue icon):




You'll now see the script editor:





Looking at the above you will see that it has a unique and descriptive name 'Update Cambelt Changed Date'.

The options have stated that this action needs access to the invoice and the vehicle (but not the client).  Because of these options the action will only run when there is a vehicle, so not for parts only invoices.

The script is where the main work takes place, it uses Pascal Script (see pascal script documents). If you follow the script from the top downwards it first checks to see that the DocumentManager's SaveType_ is an invoice and if so it then set's the vehicle's CAMBELT_CHANGED user field to Date() which is today's date.


When you press 'Ok' the extended part action will be saved and then become available when creating new part actions:




Using extended part action scripts you could do such things as increment a customer's loyalty points depending upon how much they've spent on the invoice, or if they've purchased a specific part, or selection of parts.