Portal Community

1. Check a Balance Before a Payout Step

Guard a downstream payout/transfer action by confirming the treasury account has enough HBAR first.

  1. Hedera node: resource=account, operation=getBalance, accountId={{treasuryAccountId}}
  2. Condition node: balanceHbar >= requiredAmount
  3. If true, continue to the payout step; if false, route to an alert/notification branch
Why here: This is a read-only pre-check — it doesn't move funds itself, it just protects a later step (today, likely an off-chain payout or a manual approval) from firing against an account that can't cover it.

2. Poll an HCS Topic as a Workflow Trigger

Use a topic as a lightweight event bus: an external system submits messages to it, and a workflow polls for new ones.

  1. Store the last processed sequenceNumber somewhere the workflow can read/write (a variable, a small table row).
  2. On each run: Hedera node, resource=topic, operation=getMessages, topicId={{topicId}}, sequenceFrom={{lastSeen + 1}}
  3. For each message returned, parse the JSON payload and branch on its event field.
  4. Update the stored sequenceNumber to the highest one seen this run.
Tip: Keep limit modest (25–50) on a frequent poll — you'll catch up quickly across a few runs rather than requesting a huge page every time.

3. Look Up a Token and an Account's Holdings Together

Combine token metadata with a specific account's balance, e.g. to display "Account X holds 500 EXT (Example Token)" in a report.

  1. Hedera node: resource=token, operation=getInfo, tokenId={{tokenId}} → get symbol, decimals, name
  2. Hedera node: resource=token, operation=getBalances, accountId={{accountId}} → find the entry matching tokenId
  3. Transform step: displayAmount = balance / (10 ^ decimals), format as "{displayAmount} {symbol}"

4. Convert a User-Entered HBAR Amount Before a Downstream Step

A form collects an amount in HBAR from a user; a later step (today, an off-chain ledger entry; eventually, a signed transfer — see Roadmap) needs tinybar.

  1. Hedera node: resource=utility, operation=convertUnits, amount={{userInputHbar}}, fromUnit=hbar, toUnit=tinybar
  2. Pass result (the tinybar amount) into the downstream step's input field.

5. Validate a User-Entered Account ID Before Any Lookup

  1. Hedera node: resource=utility, operation=validateAddress, address={{userInput}}
  2. Condition node: isValid == true
  3. If true, proceed to account.getBalance or account.getInfo; if false, return a validation error to the user immediately instead of calling the network.