Difference between revisions of "Server processes"

From Resco's Wiki
Jump to navigation Jump to search
 
Line 29: Line 29:
 
* On-demand: You must start the job manually using the '''Run Now''' button.
 
* On-demand: You must start the job manually using the '''Run Now''' button.
  
Additionally, jobs and workflows can be executed from a different process.
+
Additionally, jobs and workflows can be executed from a different process. The job or workflow must be created before you can use it. You may iterate the same process, but it must be saved first. The number of iteration is limited to 8192.
  
 
== What can a process do ==
 
== What can a process do ==

Latest revision as of 10:10, 6 September 2021

Business logic
Client-side

Server-side

The Resco platform traditionally has a strong focus on mobility - and so has its business logic. Resco mobile apps include some business logic out-of-the-box, they can reuse/import some of the logic from the server, and they support also very powerful custom logic, both no-code (via the Rules editor) and JavaScript (via Resco JavaScript Bridge).

In some scenarios, however, it is preferable to perform automation directly on the server. Dynamics and Salesforce servers come with their own business logic solutions. In this article, we will discuss server-side business logic options in Resco Cloud. Processes are managed using the Admin Console.

Resco cloud process.png

Why server-side

The backend business logic is triggered at the data level - in your Resco Cloud organization, not in the mobile app. You can use this for example when you have several forms/views for one entity and you want to trigger an action when that entity changes. If you did that in the mobile app, you would have to write such logic in each form/view. If you trigger this action server-side, you write the logic once and you can be sure the action happens. You can also send emails from the server (if you set up a mail server), trigger push notifications, run plugins, etc.

Process categories

When creating a new process, select one of the following types or categories:

  • Workflow: When a workflow is triggered, the procedure is added to the queue of processes and performed asynchronously sometime later. Asynchronous workflows don't have an impact on the triggering actions (because the actions are already complete).
  • Real-time: A real-time process is performed immediately. It runs synchronously with the triggering action and it can affect the result of the action.
  • Job: Jobs are not triggered, instead, you can schedule them, e.g., every night at 2 AM; or you can run them on-demand.

What can start a process

Workflows and real-time workflows are always related to a particular entity. They can be triggered:

  • When a record is created
  • When a record field changes (you can select which fields trigger the action)
  • When a record is deleted

Jobs are not related to an entity. Instead, you can directly configure when to start the process:

  • Periodically: for example, every 45 minutes
  • Daily, Monthly, or Yearly
  • On-demand: You must start the job manually using the Run Now button.

Additionally, jobs and workflows can be executed from a different process. The job or workflow must be created before you can use it. You may iterate the same process, but it must be saved first. The number of iteration is limited to 8192.

What can a process do

The series of commands that a process performs is written using a user interface similar to the rules editor:

  • Define variables, querying data from the database using FetchXML
  • Add conditions that branch the workflow
  • Add functions that create, update, or delete records and fields, or perform other actions:
    • StopWorkflow: Stop workflow execution, marking the run as either a success or a failure
    • SyncService: Synchronize with another server configured via Resco CRM sync
    • SendEmail: Send an email, configuring from, to, subject, body, attachments, and regarding
    • SendEmailReference: Send an email (record from email entity - probably created out of process editor)
    • InvokeWebRequest: GET, POST, PUT, PATCH, DELETE
    • Execute: Run a plugin or process
      • Process: execute a custom process (must be of the category "job" or "workflow")
      • Plugin: execute a server plugin. Select one of the three built-in plugins or a custom plugin.
        • Custom plugin
        • RescoCRM (built-in)
          • Chat (CommentCreate, PostCreate, SendChatMessage)
          • Extensions (AddInitialRole, AddUserRole, SetUserPassword)
          • Notifications (SendEntityNotification)

Resco cloud process 2.png

If your process includes a string variable, you can access additional built-in plugins:

  • GeneratePassword: return value can be used for SetUserPassword
  • GenerateReport: generate report based on user definition (e.g format(pdf|excel|word|html))
  • MakeFullName

Resco cloud process 3.png

Examples

If you are interested in some examples, consider starting a trial for a Resco Field Service organization. It comes with several processes preconfigured.