My Application STOPPED Working After Setting It to Multi-user!

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

Hi Vlad,

based on your screenshots, at least one lookup isn’t defined, which is why you’re getting this error message.

For example, your field Sales Rep is defined as a Lookup field, but does not specify a Reference Form. As a result, the Lookup doesn’t know what to look for.

Try selecting the Users form in the Reference Form, and let me know if this fixes your issue.

1 Like

Hi Dom,

Thank you very much!

I didn’t notice that my Reference Form selection for the two Lookup fields disappeared once I set the multi-user feature for my application!
But to solve the problem, additional moves had to be made.

It’s possibly a bug, but I found the way around it — I rolled back to the latest version of my application from before I switched to multi-user. Then I renamed the form and their fields that were named “User” to something else like “Business Users”. After that, I switched to multi-user again, and everything seems to be working now!

To summarize, one must not name a form or a form field “user” if the application is intended to be switched to multi-user.

Thank you again for helping me to solve this problem!

Regards,

Vlad