Thanks Sigrid! We actually do have the default buttons set to "no views". This is a custom rule I put on the "submit" button we have :)
Original Message:
Sent: 03-12-2024 09:54
From: Sigrid Kok
Subject: Javascript code not working properly on Save and Route
Hi @Shelby Murrell
Thanks for posting the fix :)
If you use custom form buttons, turning off the standard ones, you might be able to do something like that in a regular rule. Just a thought in case you want to consider it. It's on the workflow tab - search for buttons and you will see the Form Default Buttons, which you specify which views, if any, have the default buttons - with the default being All Views. You can change it to only have certain views use the default buttons or no views, which is what I usually do. Then I can add rules and also change placement.

Then on the approve/submit/complete button you add, you can have rules that check for various things, like did they validate or post or the rules you mentioned for currency and decimals.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
Precisely Software Inc.
------------------------------
Original Message:
Sent: 03-07-2024 20:00
From: Shelby Murrell
Subject: Javascript code not working properly on Save and Route
30 min after I posted this I ended up figuring out the code and it worked. In case it may help someone else. I was missing an else if.
if ($form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') === 'JPY' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') === 'COP' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') === 'KRW' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') === 'CLP')
if ($form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Standard_price').toString().match(/\./) !== null){
$form.showMessage('Currency Key does not allow decimals for Standard Price', 'Error');
} else {
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId');
} else if ($form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') != 'JPY' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') != 'COP' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') != 'KRW' || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Currency_Key') != 'CLP')
if ($form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Standard_price').toString().match(/\./) === null || $form.getValue('/my:myFields/my:FG_Validate/my:FG_Validate_Input/my:Repeating_Content/my:Standard_price').toString().match(/\./) != null){
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId');
}
------------------------------
Shelby Murrell
SAP Winshuttle Analyst
MONSTER ENERGY
[USA]