Hello Support,
I’ve been struggling to create / update a concatenated field (named “DealName”) in the table of my database from the form (named “Deals”) based on selections on other fields on the same form. (Database table structure image and the “Deals” form’s fields image are attached.)
In the table “Deals”, the field “DealName” holds concatenated values of 3 fields from 3 related tables: “Deals”, “Lenders”, and “Clients”. (see the database structure image attached).
I need the “DealName” field of the “Deals” table to update automatically whenever any of the values in the 3 related fields are updated.
The fields in the 3 related tables are:
“DealDate” in “Deals” table
“LenderName” in “Lenders” table
“ClilentCompanyName” in “Clients” table.
I used the following Function (named “ConcatenateDealName”) attached to the Do Complete event of the “Deals” form:
function ConcatenateDealName(five, context, result) {
const dealDate = five.field.Deals.DealDate;
const lenderName = five.field.Lenders.LenderName;
const clientCompanyName = five.field.Clients.ClientCompanyName;
five.field.Deals.DealName = (dealDate + "-" + lenderName + "-" + clientCompanyName);
return five.success(result);
}
When I try to save the form by clicking the ticker icon, I get the following error message:
Error : ErrScriptError
Message : TypeError: Cannot read property ‘Deals’ of null > ConcatenateDealName.fs.js:3:33
System Error : TypeError: Cannot read property ‘Deals’ of null
Trace : TypeError: Cannot read property ‘Deals’ of null at ConcatenateDealName (ConcatenateDealName.fs.js:3:33)
Query: mutation ProcessTransactions($selectionKey100: String!, $actionKey100: String!, $parentSelectionKey100: String, $keys100: [String]!, $versionKey100: String!, $fieldUpgradeData100: String, $fieldNames100: [String], $values100: [String]) { update100:dbapiFormDataSave( selectionKey: $selectionKey100, actionKey: $actionKey100, parentSelectionKey: $parentSelectionKey100, keys: $keys100, versionKey: $versionKey100, fieldUpgradeData: $fieldUpgradeData100, fieldNames: $fieldNames100, values: $values100) { entityUpdate{ keys versionKey versionsExist permissions values { name value type } } } }
Variables: {“selectionKey100”:“ed77d8e5-8fae-4903-895b-1205a70cb869”,“actionKey100”:“add80175-8752-4f67-8d21-eecd8221c677”,“parentSelectionKey100”:“000000-0000-0000-000000”,“keys100”:[“2ae3a1ff-cf44-4036-ad85-6222f3a78b3f”],“versionKey100”:“5384378d-4b41-11ef-85ca-509a4c524f9a”,“fieldNames100”:[“DealName”,“DealDate”,“DealAmount”,“DealCommissionRate”,“DealCommissionAmount”,“LendersKey”,“ClientsKey”,“DealStatusKey”],“values100”:[“2024-01-22-Rapid Finance-Stellar Dynamics”,“2024-01-22”,“970000”,20,“194000”,“196827be-0ffb-4873-9865-684bf7c1b335”,“5f4cc96b-1aee-4c4d-bb97-7a1213cd1870”,“b3091ed9-5994-4452-b531-21f9ba124056”],“fieldUpgradeData100”:“”}
Please HELP to solve this issue!
THANK YOU!
Vlad