How-To for Workflows

Business Enterprise


See also

How-To Make Choices In Workflows: Choosing Paths based on Toggle, Dropdown, or Segment Fields; AND Tests

Jump Straight to


Data Flow

Copying values from Asset to Request to Job

 

Workflows are designed to do one task based on a previous task, with data flowing between tasks. So, given an asset, a request, and a job, how can we match up the fields?

(1) Make sure you have a Read Asset/Request connector. This makes the data from the Asset/Request available to later connectors in the workflow. Select the appropriate form on the Output Data tab of the Read connector.

(2) If you are trying to copy values from a Request Details tab from a Request to a Job, turn on the “Job Details” toggle as shown in the picture below.

(3) Use the Parameter type when entering data in the Input Data fields. From the field type drop downs, switch them from Text/Number to Parameter if needed.

The diagram below gives you an idea of which fields match. You may decide to do it slightly differently, such as using the Customer Asset Name (from Asset) as the Client Reference (Request).

Asset to Request to Job field links

 


Parameter Selection Box Problems

My Parameter Selection box in an Email Connector is empty. What do I do?

You are missing a “Generate Link” connector. There must be one further up the workflow. If you have one in the workflow, make sure it proceeds the email connector, and it isn’t on a separate branch.

Have this?

You need this!

My Parameter Selection box does not show the fields in the Asset/Job/Request form. What do I do?

In the Read Asset/Job/Request connector, go to the Output tab and select the form type. Gruntify does not automatically select the matching form so you need to select the form that is used to create the Asset/Job/Request.

Have this?

Want This?

You need this!

If after both of the above you still can’t see what you’d expect, try this.


Saving and Older Versions

I made a change and then changed my mind. How can I get my old version back?

Go to the View History option in the top left-hand corner of the Builder view. This will display a list of older versions of your Workflow. You can look at a thumbnail of each version and when you find the one you want, restore this older version as the current version.


Emails

How can I get information from an Asset/Job/Request and include it in my Email?

The text in the email sent by the Email connector cannot be modified, but you can include a link to an Asset, Job, or Request in the email. The recipient can then look at the details directly in Gruntify.

This ensures that the person looking at the email will not be looking at an out-of-date version of the details.

If the Asset, Job, or Request is already in the Workflow, all you need to do is add a Link connector, then reference the Link Connector.

Click on the screenshot on the right to zoom the image, and watch the video below to see how to set up the Email connectors.

Do I need to link my Email to an Asset/Job/Request?

No, you don’t. The fields where you create the link are optional so you can just send a fixed text email.

Can I include a non-Gruntify link in an Email?

If you want to include a URL in your emails, such as a web page on your company website or training page, then you can include it using the Action Button fields. This will give you a single button at the bottom of the email for the user to click.

You cannot use HTML to embed multiple links in your email - the HTML will appear as regular text in the email.

How can I send an email to someone who is not a user in my workspace?

You cannot do this. You can only send to users in your workspace.

This is to reduce the chance that Gruntify sent emails will be seen as SPAM emails, protecting your organization and Gruntify from a SPAM email complaint.


Advanced Input

The Parameter Selection box doesn’t show me the options I expect, what can I do?

First, if you’re looking for fields that are on your form, try the steps here.

When you’re selecting a parameter, the selector tries to help you out by refining the results to only display fields that match the data type expected by the input. Sometimes, this will mean that you won’t see options you expect because the data types don’t match.

Take the ‘Send Email’ task for example, the ‘To Users’ input expects an Array of Email Addresses. If you wanted to use a text field on your form to determine who receives the email, you won’t find any form fields in the parameter dropdown for ‘To Users’. Thats because text fields are a String type, not specifically an Email Address type.

If you want to override this behavior, you can do that with the ‘Advanced Input’ option in the input type dropdown. This option allows you to write your own expression in JavaScript syntax. For our purposes here, this will just be:

  • The ID of the Read Request/Job/Asset task in the Workflow

  • The word ‘form’

  • The control ID of the text field in the form

TIP! An Array input can accept one or more values. If you’re only supplying one value, you don’t need to wrap it in square brackets.

You can see an example of this below, where ‘TextField-3usf’ is a text field on the form where you can enter an email address.

Control Labels vs Control IDs

When you are setting up your form in the form builder, each control has 2 options that you can specify that help identify that control. The ‘Label’ is what your users see written above the input, and is how you will see controls referred to by the Parameter Selector. On the other hand, the ‘Control ID’ is the internal identifier used to refer to that control by Gruntify apps under the hood. Each control has a default ID which is unique, but if you’d prefer you can change it to something more human-readable.

With the above example saved, we can now send emails dynamically based on the form field we specified! This use-case can be applied to other parameter inputs where the data types don’t match as well. The only thing to keep in mind is that some data types can’t be automatically converted (for example, a word can’t be converted into a number). If your data doesn’t match the required input type and it can’t be converted, your Workflow will fail when it runs.

I want to automatically compute a field by manipulating other data, is that possible?

Absolutely! With Advanced Input, you can define your own JavaScript expressions that perform any number of calculations or manipulations to come to a result. This is not for the faint of heart though, as you will need to understand how to write JavaScript to process your data.

First, find an input that you’d like to compute the result of - this can be a field in a Request/Job/Asset form, or a standard task input. Using the input type dropdown (in the top-right of any input field), select ‘Advanced Input’. Then, when you click on the input box, you should see the Expression Editor as below:

To start you off, the editor will suggest ‘Key classes’ - these are the task IDs of tasks in your Workflow which contain output data you may want to manipulate (such as Read Request/Job/Asset tasks). This is not an exhaustive list of available tasks with outputs.

In the expression text area, you can start writing JavaScript to compute your result. It should be noted that when we say that this is a JavaScript ‘expression’, you can think of that as anything that you would be able to put on the right-hand side of a variable assignment. As such, you cannot:

  • Assign variables inside the expression

  • Use any keywords like: for, if, return, break, etc.

  • Start a new block scope

Here are some examples of valid expressions:

Simple addition

request1234.form.number_one + request1234.form.number_two

Map/Reduce

asset1234.form.repeater_control .map((repeaterEntry) => repeaterEntry.text_field) .reduce((a, b) => a + "\n" + b)

Index accessor

job1234.assetIds[0]

 

If you get stuck and would like some assistance with Advanced Input in Workflow Studio, feel free to create a support ticket in our customer portal. Our technicians will be happy to help you out with your custom expressions.

Related articles