Process Functions

User guide · Administrator

Process Functions

The functions you can attach to a step of a process: what each one does and which parameters it takes. The most used ones come first, with examples.

Reference70 functionsParameters

Where functions are used

A function runs when a record reaches a step of its process. You choose it in two places (Work Flow):

  • Function and Parameters of the step itself: one function per step;
  • rows of Process automation for the same step: as many functions as you need, run before the function of the step.
The function SendEmail on a step, with its parameters.
Important
If a function returns an error, the record stays in its status and the user sees the message.

How to write parameters

  • Separate the values with a vertical bar |, without spaces: template|staff_id|first_level_management_chain.
  • Field names are the names of the columns of the record (for example staff_id, contact_id), not their labels.
  • Template names are the names in the module E-mail templates.

The most used functions

These five cover most processes: e-mails, your own checks in SQL, required fields and approvals.

SendEmail

Sends an e-mail made from a template of the module E-mail templates.

template_name|recipient_1|recipient_2|…   Example: onboarding_new_employee_en|staff_json

RecipientWho gets the e-mail
a column of the recordThe person in that field: an employee, a user or a contact, for example staff_id.
a column with an e-mail address, or an addressThat address.
first_level_management_chainThe manager one level above the employee.
management_chainThe managers two levels above the employee.
staff_jsonThe employees in the JSON field staff_json of the record, for example [1,2,3]; first_manager_json, second_manager_json, observers_json and budget_owners work the same way.
__PRIV__GroupNameEverybody in that privilege group, for example __PRIV__Accounting.
Tip
The recipients are read from the record as it was before the status change: fill in and save the recipient field first.

RawSQLWithUser

Runs an SQL function of your own, for checks or changes that no ready function covers. Parameter: the name of the function.

  • The function takes two integers: the ID of the record and the ID of the user who changes the status.
  • To stop the step, the function raises an error; its text is shown to the user. To let the step go on, it returns normally (for example OK).
  • A returned text is not an error: it is added to the success message and the step goes on.

Example: check_overtime_cancellation on the step canceled of Overtime requests.

CheckIfFieldIsNotEmpty

Stops the step while one of the listed fields is empty. Parameters: feedback or several fields: contact_id|email.

RawSQL

Like RawSQLWithUser, but the SQL function takes only the ID of the record. Use RawSQLWithUser when you need to know who changed the status.

RequestApprovalWithSystemEmail

Sends an approval request to the managers of the requester. The managers approve or reject in Approval Requests, and OBS sets the status Approved or Rejected (Approvals).

  • The module needs the option Approvals in the Constructor (it adds approved, approved_by, rejected …) and the steps approved and rejected with Manual status change off.
  • The requester must be an employee with a user.
  • Parameters (all optional): first_level_management (only the first-level manager), a field that points to an employee who also gets the request, an e-mail template, or a combination: field|template|…. __approvers__|template asks all employees in the JSON field approvers.
  • The request uses the template request_for_approval, unless you give another. For the decision you can add the templates <module>_approve and <module>_reject.

All functions

By topic. "only" means the function works in that module only.

E-mails and messages

FunctionWhat it does
SendEmailSends an e-mail template. Parameters: template|recipient|recipient… (see SendEmail).
SendEmailWithAttachmentLike SendEmail, and attaches a PDF of the record made from its document template. Same parameters as SendEmail.
SendEmailWithLatestAttachedFileLike SendEmail, and attaches the file uploaded last to the record. Same parameters as SendEmail.
ChatMessageSends a push message to the OBS mobile app. Parameters: message|recipient|recipient…; the recipients are the same kinds as for SendEmail, or user IDs.
RequestReviewSends a review request by e-mail. Parameters: template|email1|email2.
NotifyNextTaskAssigneeNo description in OBS yet. Ask OBS support before you use it.

Approvals and signatures

FunctionWhat it does
RequestApprovalWithSystemEmailAsks the managers of the requester for approval; the e-mails go from the system e-mail (see below).
RequestApprovalThe same approval, but the request e-mail goes from the personal e-mail of the requester.
RequestApprovalCustomProcessApproval by a list of approvers in several levels, returned by your own SQL function. Parameters: function|request_template|approved_template|rejected_template. Needs a sub-module <module>_approvers (copy expense_requests_approvers).
RequestApproval_ApprovalTypesApproval set up in the module Approval process types (who approves, for which module).
ApplyDigitalSignatureAsks the user for the login password before the step and records the signature (Digital Signature).
RequestSignatureWithEvrtorustMakes a PDF of the record and sends it to Evrotrust for signing by the employee in the field staff_id. The module needs a text field name (Digital Signature).
CreatePDFSnapshotCreates a PDF snapshot of the record.

Checks (stop the step when something is missing)

FunctionWhat it does
CheckIfFieldIsNotEmptyStops the step while a field is empty. Parameters: one or more field names, contact_id|email.
CheckForAttachmentStops the step if the record has no attached file.
CheckForAttachedEmailStops the step if the record has no related e-mail. The module needs Mailings turned on.
CheckIfConditionIsMetStops the step unless a condition is true. Format: field_name[module.field_name <>= value].
ContactValidationChecks that fields of a linked record are filled in. Example: record_id->contract_clients->client_id:field1|field2.
CheckIfRelatedAreCompletedChecks that the tick boxes of the related records are all ticked.
CheckIfAllTasksAreCompletedChecks that all assigned tasks are completed or rejected.
CheckTaskCheckListA task cannot be completed until all checklist items are done.
CheckTaskDependenciesChecks that the tasks this task depends on are in the required status (Start-to-Start, Start-to-Finish, Finish-to-Start, Finish-to-Finish), as set in Task dependencies.
CheckExpenseChecks that the related expenses are paid.
CheckIncomeChecks that the related invoices are paid.
CheckIfExpensesAreApprovedQuotations only: checks that all expenses of the quotation are approved.
CheckIfWarehouseSlipExistsChecks that a warehouse slip for the document exists. Parameter: the status (ID) the slip must have.
PickMaterialFromGroupStops the step if the recipe has a material group, and asks the user to pick a specific material.

SQL, API and files

FunctionWhat it does
RawSQLWithUserRuns your SQL function with the record and the user (see below).
RawSQLRuns your SQL function with the record only. Parameter: the function name; the function takes one integer (the record ID).
CallAPIEndpointCalls an OBS address built from fields of the record, for example /api/~~col_name~~/~~col_name1~~.
FileOperationsWorks with the files attached to the record, for example processes attached MT940 bank statements.

Create and change records

FunctionWhat it does
CopyRecordCopies the record; the copy starts in the first status.
ConvertDocumentCopies the document into another module by a column mapping set up in Module conversion mapping. Parameter: the name of the mapping.
CreateProjectCreates a project from the record. The module needs project_id, deadline, issuer, contact_id and company_id.
CreateProjectFromQuotationWithItemsCreates a project from a quotation, with its materials and products.
CreateQuoteFromBudgetCreates a quotation from a budget.
CreateQuoteFromProjectCreates a quotation (without items) from a project and links it to the project.
CreateInvoiceFromOrderCreates an invoice from an order.
CreateInvoiceFromWorksheetNo description in OBS yet. Ask OBS support before you use it.
CreateInvoicesFromContractPaymentsContracts only: creates the invoices of the payment plan, one per payment.
CreateExpenseFromContractCreates an expense from a contract. Parameters: key:value|key1:value1|….
CreateBulkPurchaseOrderFromOrderCreates purchase orders (in Expenses) for the materials that are not in stock: minimum stock + minimum order quantity − quantity in stock.
CreateEmploymentContractFromStaffStaff only: creates an employment contract from the template employment_contracts.
CreateStaffFromPotentialCandidatePotential candidates only: creates an employee from the candidate.
CreateSubRecordsNo description in OBS yet. Ask OBS support before you use it.
CreateWhSlipsFromTransferCreates the two warehouse slips of a warehouse transfer.
RemoveRelatedRecordDeletes a related record. Parameter: the field that points to it.
StartProjectSets the related project (field project_id) to started.
MarkPaidTicks Paid on the record.
ApproveRelatedExpensesApproves all expense rows of the record.
TransferToNextClassMoves the items that are not completed to the next time.

Warehouse and manufacturing

FunctionWhat it does
AddQtyToWareHouseWarehouse slips only: adds the quantities to the stock.
RemoveQtyFromWarehouseRemoves the quantities from the stock.
TransferQtyWarehouse transfers only: moves quantities from one location to another.
BlockQTYBlocks quantities in stock.
BlockQtyInWarehouseBlocks quantities in the warehouse.
ReleaseQTYReleases blocked quantities.
AddQtyToAssetWareHouseNo description in OBS yet. Ask OBS support before you use it.
RemoveQtyFromAssetWarehouseNo description in OBS yet. Ask OBS support before you use it.
TransferAssetQtyNo description in OBS yet. Ask OBS support before you use it.
WarehouseTransferManufacturing requests only: moves the product to another location. Parameters: SourceWarehouseID -> DestinationWarehouseID, for example 1 -> 2.
ManufactureProductManufacturing requests only: makes the product from its recipe. Parameters as WarehouseTransfer.
ManufactureProductFIFOLike ManufactureProduct; the materials are taken first in, first out.
ManufactureProductLIFOLike ManufactureProduct; the materials are taken last in, first out.
ManufactureProductsAndTransferMaterialsActivity reports only: checks the stock of the materials (also inside products) and creates manufacturing requests and warehouse transfers.
RollBackManufacturingRequestUndoes a manufacturing request: deletes its products and materials from the warehouse slips and restores the quantities.
OrderReversalNo description in OBS yet. Ask OBS support before you use it.

Tenders and surveys

FunctionWhat it does
StartBulkTenders and Surveys only: creates one participant record per recipient, with a copy of the questions. Add the participants first.
InformRecipientsTenders and Surveys only: e-mails each participant the link to the tender or survey. Add system_email to the parameters to send from the system e-mail.
CompleteSurveyTenders only: starts the negotiation with the selected winner; the winner confirms the final price through a link in the e-mail.

FAQ

A function I need is not in the list.
Write your own SQL function and attach it with RawSQLWithUser, or ask OBS support.
Can a step have two functions?
Yes: put one on the step and the others in Process automation for the same step.
Why is RequestSignatureWithEvrtorust spelled like that?
That is the name in OBS: choose it exactly as written.

Related: Work Flow · Digital Signature · Document Templates.

The function SendEmail on a step, with its parameters.