How do I get a Skuid Action Sequence to do different things based on some other things?

Skuid Action Sequence

How do you wire a complex logic into a single, concise, maintainable Skuid Action Sequence? Advanced Salesforce Developer Simon Lawrence has answers on how this worksย on Skuid’s no-code platform.ย 


As far as blog titles go, this probably isnโ€™t theย mostย technical I have ever written, but it isย exactlyย what I remember thinking as I was presented with getting a complex Skuid Action Sequence to do one or two specific different things based on some attributes of a model.

As a (hopefully) clear example, imagine if you had an Action Sequence being executed when you clicked a button, that among things like saving some models, activating a model condition, invoking a couple of component actions and thenย ifย one of the Models on the page was saved with a certain check-box value, created and saved a new audit record with a timestamp in it as well; how might you wire that all into one, concise, maintainable structure?

Now, up until recently, my mind would turn to automation tools for that sort of thing; When Model A was updated I could fire a Trigger or Process Builder to evaluate the checkbox and if necessary save a new Audit record. That would totally work, and this is great, but there are a few downsides. Obviously with Triggers, we are coding ourselves into a higher level of maintenance, and even with Process Builders, we are scattering our automation all over the place. If there is one thing Salesforce is not short of, itโ€™s places to hide bits of functionality.

If we are doing everything else in this button press in Skuid, why not also conditionally make the Audit record on save?

The longer you use Skuid, the more amazing features you uncover, we all know that right? Well through 2018 I have discovered, and become increasingly interested in the event driven aspect of the Action framework, and these conditional logic branches.

If I was faced with the above requirement of saving a new Audit record with some values in it whenever an Opportunity was saved, with a certain Check-box tickedโ€ฆ I would follow something like these following screenshots..:

1. Firstly, you can tether Skuid โ€œActionsโ€ onto the data โ€œActionsโ€ of a model, such as when they are saved or deleted.

tether Skuid โ€œActionsโ€ onto the data โ€œActionsโ€ of a model

2. We can define what events we want to trigger our sequence, you can have multiple sequences for the same actions, and multiple actions firing the same sequence!

Define what Skuid events we want to trigger our sequence

3. Now, from the Actions tab, we can add an Action element which is โ€œLogic > Branchโ€

Add an Action element which is โ€œLogic > Branchโ€

4. Here –ย for one of the very few times in Skuidย – the GUI-builder falls a little short, because you canโ€™t just click away and build a powerful set of conditions, we have to revert to our former Excel/Formula Field selves and write a formula that governs entry to the branch:

A formula that governs entry to the branch

We can pick the Model on which the formula is based though, because Logic branches can be included in any Action Sequence, so it might not always be as obvious as from one fired from a Model Event. In this case, we say we only want to enter the branch if the Is_Tracked__c field is true, which is simple enough.

We then use theย plus arrow on the Branch elementย to create new actions within it

Use the plus arrow on the Branch element to create new actions

And they nest in beneath it like so:

Nesting in Skuid

And just like that, when rows in our Opportunity Model are saved,ย only ifย their โ€œIs_Audited__cโ€ checkbox is ticked, Skuid will create (populated) Audit records and save them.

If you have an up-to-date (v11.2+) version of Skuid too, there is another sexy option on the logic branch for what to do next –

Skuid will create (populated) Audit records and save them

So you can end execution if you logic branch is perhaps determining an end-game for that action, or you can just let execution flow on to continue doing all sorts of other things (including other logic branches!)

So consider the following fairly complex action sequence that is fired on the instant an Opportunity record is saved:

Logic branch determining an end-game for that action

  1. First off, if the Opportunity is Tracked, we create and save and audit record. After this branch, we continue execution.
  2. Whenever the Opportunity record is saved, we clear out some other model, or do anything else – in all cases.
  3. Now, if the opportunityย isnโ€™tย marked as complete – we show a specific pop-up to the user. On this action, we elect to โ€œNot run any other actionsโ€ and the experience halts with the popup.
  4. If the last branch wasย notย met (ie. the โ€œOpportunity is completeโ€ logic did not fire) we instead open a sliding panel. This has executed kind of like an โ€œelseโ€ to the branch in No.3.

How cool is that then? All this done in Skuid – in one place, and thus it is super accessible and customisable by future users without the need for code, or even Cloning/Activating/Deactivating a dozen Flows.

Work with Desynit

Looking for exceptional, professional Salesforce support?

Our independent tech team has been servicing enterprise clients for over 15 years from our HQ in Bristol, UK. Let’s see how we can work together and get the most out of your Salesforce implementation.