Switch module walkthrough

Understand how to use the Switch module when you need to perform more complex or dynamic data transformations.

An image using the switch module

Switch module walkthrough

Workfront recommends watching the exercise walkthrough video before trying to recreate the exercise in your own environment.

Transcript
The purpose of this next walkthrough exercise is to introduce you to the switch module. We’re going to use the switch module to evaluate a custom form field on certain projects in your test drive and then change the project name based off of the selection in that field. You’ll want to have a new scenario built for this walkthrough exercise, as well as have your test drive opened up. I went ahead and created a custom filter to only look at projects that have the direct mail project information form attached, as well as a view that shows that custom form as well as the custom form field selection for channel. Having this set up will just make it easier to validate once you run or test your scenario after building it.
Let’s start by creating a new scenario and titling it Using The Switch Module. For our trigger we’ll use the Workfront search records module.
For record type we’ll choose project and we’ll leave the results set and the max number of matching records as the defaults. For the search criteria, we only want to pull in projects where the channel field on the custom form is filled in. I can do that by clicking into the pick list and typing in DE-Channel to find that field.
Once I do, I’m going to change the basic operator from Exist all the way down to the bottom to Not blank meaning we only want to find projects and use them in the scenario if that channel is filled out. Finally, for outputs, I want the ID of the project, the name, the reference number, and that channel custom form field. I’ll find them quickly by using Command or Control+F to search for them.
Go ahead and click OK.
Now let’s quickly rename our module find direct mail projects.
In the next video we’ll add the switch module to change the project names.
Let’s start by clicking the icon at the right of our trigger module to add a new module. For this we’re going to add the switch tool module.
For the input on the switch module, we want to evaluate what’s contained within that channel custom form field on each project. Go ahead and click that to add it to the input field.
We’re then going to create six different cases for the six options that you could choose in the channel dropdown. I’ll go ahead and add the first one as social. For the pattern to recognize in that channel field, I simply want to type out social the same way that it’s written in the custom form field. For the output, we’re going to change this to a three letter acronym for social type projects. We’ll add the reference number, a hyphen, and then the actual project name. So for social, I’ll do S-C-L and then I’ll do a space and select the reference number from the mapping panel, another space with a hyphen, and then I’ll finish with the project name. So essentially what we’re doing with the switch module is we’re evaluating the custom form field. If it’s social for a certain project it’s going to change the project name to S-C-L reference number, name. We’ll update the name in the next module that we’ll create, but for now, let’s add the five other case options.
Now, I’ve successfully added all six options for the channel custom form field. Social, web, video, print, email and event. And as recognized against the pattern we’ll change the name of the project using the output for each of those six different cases. Our else statement we can change to whatever we want. I’m going to leave this simply as project name because we shouldn’t run into a situation based off of our search criteria where one of these fields is not selected. Let’s go ahead and click OK and then we’ll rename this Change Project Name.
Finally, let’s add the Workfront update record module to use the output from our switch module to change the project name.
For ID, I’m going to pull the ID item from our trigger module. For record type, I’ll of course choose project and then I’ll use Command or Control+F to find the project name. For this field I’ll click in and from the mapping panel I’ll choose the output for the new project name. Go ahead and click OK to save your work.
Finally, let’s rename our third module Update Project Name.
Let’s go ahead and run the scenario and then go into our Workfront test drive to see how the project names have been updated.
We can see that we’ve successfully operated on 17 different records or projects, and if we go into our Workfront test drive and refresh the page, we now have projects that have the three letter ID we created for each channel, the reference number, followed by the project name as it was when created originally. -

Want to learn more? We recommend the following:

Workfront Fusion documentation

recommendation-more-help
c9fbcf61-6d19-481e-a9ab-f54a0ae0ee8a