DEV Community

P V Vighnesh
P V Vighnesh

Posted on

Calling a Screen flow from a Vlocity Action

This post is exactly what the title says. Calling a Screen flow from a Vlocity Action.

If you're wondering Why do I have to call a Screen flow from a Vlocity Action?, just know that I didn't know this was even possible, until I had to build it. Even though it's a very simple thing(realizing after building it), I had to spend quite a bit of time figuring it out.

So if you're reading up to this point, you're either curios or trying to figure out something similar. Either way, let's get into it.

Build a flow

If you want to call a screen flow, you'd first need a Screen flow to call! 🤷‍♂️

I'm assuming you already have a flow you want to use. In my case, it was just a simple screen with an input field.

(Before calling this flow from Vlocity action, it was getting called from Quick action and I made use of the same Quick action)

Build a Vlocity Action

If you've ever launched an Omniscript using Vlocity Action, this is very similar.

Create a new Vlocity Action. Call it whatever you want, but remember the name, you'd need it later.

Link type : Other

Adding a Target URL is where I got confused. If it was an Omniscript, you'd get an URL. How do I get one for a flow?

After a lot of fiddling around, I decided to use the URL that comes up when we actually launch the flow from the record, with few changes.

Target URL : lightning/action/quick/<<OBJECT.ACTION_NAME>>?objectApiName&Context=RECORD_DETAIL&recordId={0}
URL Parameter : Id

Here, {0} is the contextId, meaning it will be replaced by the Id of the record from where this Action is being called.

Build a Vlocity card

Or use already existing one 😅

This is the part where you'd add the Vlocity action you just created to your Card, from where you will be launching the flow.

Select the card, and add your Action. I told you you'd need the name later.😌

You might also have to create and add a Vlocity template to your Layout/Card, depending on whether you used existing layout or created a new one. It is better to use the templates from your org to maintain UI consistency.

Final steps

Make sure all your changes are present and Activate your card.

If you've created a new Card/Layout, you'll have to add it to your Flexipage as well.

And you've built it!

You can test by clicking on the action and it should launch you straight into the Screen flow.

Thanks for reading. I post stuff on Salesforce, LWC, Vlocity, Frontend development and Design(or at least I wish to).
You can check out my ongoing LWC series here, and if you like the content, do hit the Follow button!

Peace out gif

Top comments (0)