Set/Get variables walkthrough

Look up information about a project in Workfront and send an email with related information.

An image of the Fusion scenario

Get/Set variables 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 learn how to use the set variable module and the get variable modules to pass information from one path to another. To be successful for this walkthrough exercise, you want to have your Fusion pulled up on one tab, you want to have your test drive instance on another tab, and you want to find Northstar Fashion Exhibitors Booth and have that pulled up.

You’ll also, in your third tab, want to have your personal email pulled up.

Let’s start by adding a new scenario to our exercise folder. I’ll skip past this initial screen and add my apps as we go.

Let’s call this scenario Sharing Variables Between Routing Paths.

To start my scenario, I’ll use the Search records Workfront module.

For the Record Type, we’re going to look for Projects.

For Result set, you can choose between First Matching Record or All Matching Records, and if All Matching Records is selected, you can set the maximal number of records to process each time this scenario is run. You then have Search criteria, which we covered in the filters course if you want to add a barrier to entry on your scenario so only certain bundles of information are passed through. Finally, you have an Outputs section where we can choose fields that we want to grab and use in our scenario once a matching record is found. For the Search criteria, I’m going to say that the project status, by typing those letters into the panel, is Equal to CUR, which is the three-letter key in our test drives for a current status. For Outputs, I want the ID, Command or Control + F to find the project name, Command or Control + F to find the description, and finally, Command or Control + F to find the sponsor name. What you’ll notice when you try to find sponsor name, the only available field is Sponsor ID. We’ll take care of that using another module right after this search record in just a moment. Go ahead and click OK.

Let’s add another module after from the Workfront app and choose Read a record. The reason I chose this is because I want to take the sponsor ID from my search project records and grab that user’s name. So for the Record Type here, I’m actually going to choose User from the list.

For Outputs, I’m going to choose the Name using Command or Control + F until I find the full name. And then for ID, I’m going to tie it to the sponsor ID coming from my trigger module.

Go ahead and click OK. Now, because the Workfront Search record module, which is our trigger, is going to go into our test drive and search for any project that is in a status of current, I don’t actually have to right-click this module for this walkthrough exercise and choose where to start. It will just look throughout the entire system for any project that is in a status of current. Let’s go ahead and give this scenario a quick run to see what happens.

What we can see is we received an error on our second module, our Read record in Workfront, for the user name. And if we click into the execution inspector, we can see that there’s a missing value for the parameter ID, or in other words, for some reason, a project passed through without a sponsor ID and therefore created an error on this Read a record module. So what we need to do if we want to process all projects within the system and run that information through this scenario, regardless if there’s a project sponsor or not, we’re going to have to create two different paths, one for if a project sponsor exists and one if it doesn’t.

Before creating my router, let’s rename our modules quickly, my Search records module can be renamed Find current projects.

And my Read a record module can be called Find sponsor name.

And now I want to email the information about current projects. So I’m going to use the email module to send an email and to create my second path. I’ll right-click over here and I’m going to select Add a module.

And now I’ll click into the empty module and find the email app and select Send an email.

The error that we see is simply stating that this email module needs to be connected to something else. For us to access the panel and map the fields over, I’ll click and drag the connector on the left side of the email module over to the find current projects, and this will automatically create that router. Once I do that, I can establish my connection to my email account. And then I’m just going to add my personal work email address in the To field, and click Add. Please use your own email address. For the Subject line, you can simply type in Current project information.

For the Content or the body of our email, I’ll type in Project name: and I’ll grab the name from our Search record module.

Then I’ll hit Return and I’ll type in Project description.

And grab that.

Now I want to also put in Sponsor name, but the only option I have here is sponsor ID.

That’s because the sponsor name exists in a different path up here.

In the next video, we’ll show you how to grab the sponsor name using a set and a get variable module.

Then click OK and Save. To clean up my scenario, I’m going to click on the wand icon, or the Auto-align button.

I am going to rename my Send an email module to Send project info.

Because I want to have the sponsor name available for use in the email I’m sending out, I’m going to put the sponsor name in a set variable module up in this path, and then I can access it through a get variable module down in this path. So let’s start by clicking Add another module and then search for the Set variable module.

For the variable name, I want it to be something clear and concise because it’s what I have to call when I use get variable. For this, I’ll simply say Sponsor name. My Variable lifetime, I can leave as One cycle, and my Variable value is going to be the sponsor name from the module to the left.

Go ahead and click OK.

In more complex scenarios, you’re going to have multiple set variable modules throughout. So, best practice is to rename this set and then put the variable name that’s contained within that module. Once you do that, we’re going to come down between our Router and our Send an email module and right-click on the dotted line and add a module between.

For this, let’s search for a get variable module.

This has only one field that we have to fill out and we want to type in the variable name from the different path that we want to get, in this case, the sponsor name. It must be spelled exactly the same as what’s contained within the set variable module.

Go ahead and click OK.

And similar to above, instead of set sponsor name, we’re going to rename this Get Sponsor name.

Now that we’ve done that, we can open our Send project info module.

And then in the Content field, we can add the value next to the sponsor name. Go ahead and click OK. Now, to finish this scenario, I need to add a filter to this top path so we don’t run into that error with the find sponsor name again. Go ahead and click the dotted line between the Router and the Read a record. For the label, we’ll call it Sponsor exists.

And for the Condition, you can simply say that the sponsor ID exists.

Then click OK.

Now my scenario is ready to run. But to avoid sending multiple emails for any current project in my test drive, I’m going to click into my Search records trigger module and I’m going to add one more search criteria to only find one specific project in my system and send one email out. I’ll click on the Add And Rule, and for this, I’ll say that the project ID is Equal to, and then I’m going to copy an ID for a project within my test drive. In your test drive as well, you should have the Northstar Fashion Exhibitors Booth project. You can see that it has a description and you can see that it has a project sponsor.

So I’ll grab the ID from the URL, I’ll paste it in here in my condition, and click OK.

And even though I’m searching for all current projects, I’ve now added one more search criteria or filter to find only that one specific project. So that bundle of information will pass into the router and first go down the sponsor path and it will grab the sponsor name, and it will set our variable, and then pass it to the next path where we have the get sponsor name, and then finally an email will be sent out for that one specific project. Let’s go ahead and run our scenario, but we’ll save it first and we’ll see what happens.

We can see a successful execution was performed. Opening the execution inspector for the Send an email, I can see that there was one input bundle and one output bundle, the message that was sent out. The project name, the description, and the sponsor name was all sent over correctly. Notice that the email is kind of bunched up with all that information. If I go back to my scenario and I click on Send an email, I can see that it says, “You can use HTML tags” here in the Content area. So I can do that if I want to make the message a little more clear and structured. Make sure you click OK and save your scenario. -

Your turn

NOTE
Practice exercises and challenges are optional and are not necessary to complete Fusion training.

This practice exercise builds on what you learned in the walkthrough, but the solution is not provided.

Make a clone of the “Sharing variables between routing paths” scenario you created in this walkthrough. Email the message you compose to the project owner and the project sponsor. You also want to include the project condition in the message. (For now, it’s okay that the condition appears as a two-letter key.)

Challenge: Schedule your scenario to send this “email” every week at 8 AM on Monday.

Want to learn more? We recommend the following:

Workfront Fusion documentation

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