Loading...
Started by Gerhard Jansen • Jul 2, 2025 7:10 PM
Total Replies
1
Participants
2
Activity
Quiet
Duration
7:10 PM
Thread starter
lar_rate) for a deal. It uses two deal properties as input:country (a text field)cocoroco_languages (a multi-select checkbox field, which provides a semicolon-separated string like en;de)lar_rate property on the deal.lar_rate is not updated.country and cocoroco_languages) is being received correctly. However, the code fails to find a match for the country in the rate table, even though the logged country name (e.g., 'Spain') appears to be an exact match to a key in my rate table object.crm.objects.deals.write and crm.objects.deals.readscopes.country and cocoroco_languages have known values before the code action runs. The logs confirm these values are present.country text field. It's likely that for the failing deals, the country name contains hidden characters (like non-breaking spaces, ) copied from another source. A standard JavaScript .trim() does not remove these, causing the string comparison to fail.// Input from the workflow action
const countryInput = event.inputFields['country'] || '';
// My current attempt at cleaning the data
const country = countryInput.replace(/\s/g, ' ').trim();
// ... logic to determine workingLangName ...
// The lookup logic
const countryKey = Object.keys(hourlyRates).find(
c => c.toLowerCase() === country.toLowerCase()
);
if (countryKey) {
// ... find rate based on language
} else {
// This is the log message I see for failing deals
console.log(`Result: No rate found. Country '${country}' is not in the rate table.`);
}
.replace(/\s/g, ' ') approach sufficient, or is there a more foolproof method?