Details
I need to find a way to calculate a balance based on a transaction amount.
I have a datatype named, e.g user_transactions
. This type has a field named transaction_amount
and account_balance
, respectively.
Assume the value of transaction_amount
is 10, and the initial account_balance
is 100.
What I need here is the account_balance
value to be adjusted depending on the transaction_amount
.
What I did so far, without success

I have searched pretty far down into the forum and the wiki, as well in the plugins, but I haven’t found anything that could help me, and I’m sure the issue I’m having is a pretty basic one.
Any help is appreciated.
Can you explain what is not working?
Put some example?
Details on my main issue
I needed a way to deduct the price of an action a user makes to his account balance.
I succeeded by making a simple workflow that uses the value of transaction_amount
(which stands for the price) and deducts it from the value of account_balance
(which stands for the Current user account balance).
Luckily, I managed to solve that issue by doing what I just said
Now
Though, I am facing another issue right now, which is to verify that account_balance
value.
Let me explain:
Assume the user has an account_balance
of 100. This user pays an action with a transaction_amount
value of 100. Logically, his account_balance
falls off to 0.
My issue is that if the user tries to pay an action with a transaction_amount
value of 30, but his account_balance
is at 0, it will continue to fall off into the negatives.
What I need is to verify that account_balance
when the user tries to pay, so in the case the balance is 0 or under the value of transaction_amount
, it will refuse the action.
Don’t hesitate to tell me if you need more details.
Do this verification during your workflow. It is not a big deal.
Create a custom state called “result”.
Create a workflow to run when the user click to purchase an item.
In this workflow’s first step, set “result” as the result of account_balance - transaction_amount
In the second step call the main event (the one you use to process the purchase) only if result >= 0
And in the third and last step, display a pop up alerting the user about his balance if result < 0
. Something like “Ops, insufficient funds to process this transaction”.
1 Like