The following Workflow will enable an account on payment.
If you are unfamiliar with Workflows in EngageIP see: EngageIP Workflow Engine Overview
Configuration
This script checks the users balance when a payment is made, if the balance is equal to or less than zero, the customer account will be enabled.
Workflow Event
Name – “Payment”
Event Code – Payment.Create
Action Script
Name – “Enable customer on payment”
Code Block | ||
---|---|---|
| ||
Payment pay = Payment.GetByID(Convert.ToInt32(context["PaymentID"])); User user = User.GetByID(pay.GetUser().ID); ViewUserBalanceFuture vubf = ViewUserBalanceFuture.SearchByUserID(user.ID)[0]; if (vubf.Balance <= 0) { user.UserStatusTypeID = user.GetActingOwner().SearchUserStatusTypeByName("Enabled")[0].ID; user.Update(); } return true; |