Hello Five Support Team,
After setting a perfectly functioning application to multi-user, two crucial application Forms stopped working!
They now return the error (see screenshot below) once you click any list item on the left and then log off!
The Forms details are as follows:
Form name: User Commissions
The Form is based on “UserCommissions” table (see database schema at the end of this ticket)
The Form has these 4 fields:
“Sales Rep on Deals” field specs:
“Sales Rep” field specs:
“Sales Rep Commission Rate” field specs:
"Sales Rep Commission Amount field specs (Read-Only field):
None of the fields run any Events.
The Form calls this Function on Do Complete:
function UserCommissionAmtUpdateFunction(five, context, result) {
let queryResult = five.executeQuery(‘UserCommissionAmountUPDATEQuery’);
// Assuming queryResult returns an object with a property ‘UserCommissionAmount’
if (queryResult && queryResult.UserCommissionAmount) {
five.field.UserCommissions.UserCommissionAmount = queryResult.UserCommissionAmount;
}
return five.success(result);
}
The Funciton runs this Update Query: “UserCommissionAmountUPDATEQuery”:
UPDATE UserCommissions
/* The line below arranges connection of 2 tables (‘UserCommissions’ and ‘Deals’)
to get data for calculating ‘UserCommissionAmount’ field in ‘UserCommissions’ table. */
INNER JOIN Deals ON UserCommissions.DealsKey = Deals.DealsKey
– The line below performs calculation and updates of ‘UserCommissionAmount’ field in ‘UserCommissions’ table.
SET UserCommissionAmount = (Deals.DealCommissionAmount * UserCommissionRate) / 100;
Form name: “Commission Payments”
The Form is based on “CommissionPayments” table (see database schema at the end of this ticket)
The Form has these 5 fields:
Below are the fields specs. None of the fields run any Events. The “Payment Name” field is Read-Only.
The Form calls this Function on Do Complete:
function PaymentNameUpdateFunction(five, context, result) {
let queryResult = five.executeQuery(‘PaymentNameUPDATEQuery’);
// Assuming queryResult returns an object with a property ‘PaymentName’
if (queryResult && queryResult.PaymentName) {
five.field.CommissionPayments.PaymentName = queryResult.PaymentName;
}
return five.success(result);
}
The Funciton runs this Update Query: “PaymentNameUPDATEQuery”:
UPDATE CommissionPayments
/* The line below arranges connection of 2 tables (‘CommissionPayments’ and ‘Users’)
to get data for the concatenated ‘PaymentName’ field of ‘CommissionPayments’ table. */
INNER JOIN Users ON CommissionPayments.UsersKey = Users.UsersKey
– The line below executes actual update of the field of ‘CommissionPayments’ table: ‘CommissionName’
SET CommissionPayments.PaymentName = CONCAT(CommissionPayments.PaymentDate, ‘-’, Users.UserName);
Both queries are set to “Live”
Please help me to make the two Forms above work again! They were working fine before I turned the Multi-user switch on. Below is the database schema.
Thank You!
Vlad