Field Interpolation

A number of wizard setting text inputs support wizard field and user field interpolation. This means that you can insert wizard or user data into blocks of text that the user sees in the wizard.

"Interpolation" noun. The insertion of something of a different nature into something else.

Usage

The basic usage of field interpolation is w{field_id} for wizard fields and u{field_name} for user fields.

Example

For example, if you have a field with the id "step_1_field_1" where a user enters their name, you can use that field in a post template using w{step_1_field_1}.

Settings

_______

Result

_______

Format

You must use the exact field ids, not the field labels, and exact user properties. You can see the field ids in (brackets) next to the field label.

If the value stored in the wizard field is an object, you can use dot notation to access properties of that object.

Example

For example, the value of an Upload field is an object that looks like this:

{“id”=>“17099”, “url”=>"//npn.sfo2.digitaloceanspaces.com/original/3X/a/1/a1c2bdd54a169a35e95a4cc7fc95471e3be29ad5.jpeg", “original_filename”=>“DSC_2513 - NPN 1500px 2020.03.07.jpg”, “filesize”=>“422440”, “width”=>“1500”, “height”=>“956”, “thumbnail_width”=>“690”, “thumbnail_height”=>“439”, “extension”=>“jpeg”, “short_url”=>“upload://n506tVd67Ud4VTMlxqt8nIZPTPD.jpeg”, “short_path”=>"/uploads/short-url/n506tVd67Ud4VTMlxqt8nIZPTPD.jpeg", “retain_hours”=>"", “human_filesize”=>“413 KB”}

To interpolate the url of the upload into a field, use the notation w{field_id.url}. This allows you to interpolate an image uploaded via an Upload field into a post.

Settings

_______

Result

_______

Where it's supported

Field interpolation is supported in certain text inputs.

Step descriptions

Step descriptions currently only support user fields.

Post builder (actions)

You can interpolate any fields of the wizard user, and any wizard fields in a post builder.

Text inputs

You can interpolate any fields of the wizard user in any text input. You can also interpolate any wizard field in a text input in an action.

I've been working extensively developing custom wizards using liquid for the post builder and wanted to share what I have learned since the shopify documentation will only get you so far. I have to give credit to ChatGPT which helped clean up the mess I had created, but through the process I learned a lot. I know this will be super basic for most of you, but it may help some n00b like me in the future!

First up, syntax. I have found that the syntax recommended here can cause issues when your wizard post gets complicated. Rathen than using w{step_1_field_1}, I have had more success using {{step_1_field_1}}, which from what I understand is more standard liquid syntax.

You can comment your code using the following:

{% comment %} Commented text {% endcomment %}

Display an image from the upload field

Simple example of using .file_name and .url from the upload field

![{{step_1_field_1.file_name}}]({{step_1_field_1.url}})

Display if field is not blank

Here I have a text field where I've added a title and this will only display if the field is filled out.

{% if step_2_field_9 != blank %}### Description{{step_2_field_9}}{% endif %}

Display text based upon a dropdown selection

In this example you will need a dropdown field and in this case the field is mapped to "example"

{% if step_1_field_1 == "example" %}Example Text{% endif %}

Use with checkboxes

{% if step_1_field_10 == "true" %}Example Text{% endif %}

Display uploaded files

Here I had an upload field that allows pdf's as a filetype and I wanted to display the file in the post.

## Files{% if step_4_field_1 != blank %}[{{step_4_field_1.file_name}}|attachment]({{step_4_field_1.short_url}}) ({{step_4_field_1.human_filesize}}){% endif %}

or / and statements

{% if step_1_field_10 == "true" or step_1_field_11 == "true" or step_1_field_12 == "true" or step_1_field_13 == "true" %}

Could be possible that Wizard marks a checklist if user do something like post in a specific category or thread? Maybe using webhooks?

Thanks for your plugin, I'll move to paid if I can finish our workflow.

Hey, yes you can save topic custom fields when using the create topic action.

https://discourse.pluginmanager.org/t/action-settings

On another topic

p.s. I’d love to see an overview of how this plugin works behind the scenes!

A course on plugin development, which will include a unit on this plugin will be coming in late 2022.

Does Custom Wizard store field data on the topics directly? I'd like to be able to add some basic fields to new topics that could be searchable from somewhere else in the forum. Is this possible?

p.s. I'd love to see an overview of how this plugin works behind the scenes!

The value is not currently available for interpolation. There might be a way to do it with liquid, which the post builder supports. Sorry I don't have the time to figure it out right now, or add support.

https://shopify.github.io/liquid/

Hey guys

for dropdown flields by default the Key is displayed and not the value when I am using the w{step_2_field_3} placeholder for the post created. How can I display the value instead?

I tried w{step_2_field_3.value} but it results in empty output.

When the field type is Category, w{step_2_field_1} outputs the category number quoted inside brackets, i.e. [“6”] instead of the category name. How do I output the name?

Same thing when the field type is a tag.

Field types checkbox and textarea output only true if user supplied text in textarea or **** if left empty. I want the user-supplied text to be outputted.

EDIT: I'm using field type Dropdown with mapped content to achieve my goal and resolve my previous issues.

Hey Angus

How would display more that one uploaded image into a post? In my specific case the number of images uploaded in the wizard is not defined.

Hey @angus, is it possible to take a User Customised Field and interpolate it?

I ask because I need to ask people's background for approvals as a UCF (pre signup wizard), and then would like to give them the opportunity to improve upon what they wrote before inserting it into bio_raw.

We currently cannot use Update Profile in Actions to map a UF (or UCF) to another User Field. I also tried to just push it from my UCF to bio_raw using the Custom feature of Update Profile in Actions, but couldn't make it work.

Any thoughts?

Great documentation, kudos!

when publishing as a topic, is there a way to interpolate a wizard dropdown field’s key and value fields? Have tried w{field.key} and w{field.value} and similar to no avail.