Hello Five Support Team,
In my application, I’m experiencing the following glitch:
When I create a new Payment record, it is created fine, but the Payment Name does not appear in the list on the left (it shows up blank - see screenshot).
However, when I either edit this record right away and save OR go to any other page of my application and then return to the Commission Payments page, the Payment Name appears just fine. Five doesn’t return any errors.
Technical Details:
The “Payment Name” is an automatically created (read-only) concatenated field that consists of the Payment Date and the name of the person, who received the payment.
The Form runs the Function below on “Do Complete” event.
The Function runs two Queries. The first Query is the one that generates data in the Payment Name field.
function PaymentNameUpdateFunction(five, context, result) {
// Execute the first update query
let queryResult1 = five.executeQuery(‘PaymentNameUPDATEQuery’);
// Assuming queryResult returns an object with a property ‘PaymentName’
if (queryResult1 && queryResult1.PaymentName) {
five.field.CommissionPayments.PaymentName = queryResult1.PaymentName;
}
// Execute the second update query
let queryResult2 = five.executeQuery('iUserKeyInCommPaymntsUPDATEQuery');
// Assuming queryResult returns an object with a property 'iUserKey'
if (queryResult2 && queryResult2.iUserKey) {
five.field.CommissionPayments.iUserKey = queryResult2.iUserKey;
}
return five.success(result);
}
Below is the first Query in the function above:
UPDATE CommissionPayments
INNER JOIN Users ON CommissionPayments.UsersKey = Users.UsersKey
SET CommissionPayments.PaymentName = CONCAT(CommissionPayments.PaymentDate, ‘-’, Users.UserName);
How to make the name of the new record appear right away, as soon as the new record is saved?
Thank you.
Vlad