Autopopulate field choice when another field choice is selected

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 03:20 AM
Hi all,
On the "customer_account" table, I need a script that will autopopulate the choice "u_annual" in the field "billing_info" whenever the choice "u_years" is selected in the "billing_history" field.
Additionally, is there a way to update this for both existing records and future ones in the same script?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 03:28 AM
Hi @Community Alums
following links help you to resolve your doubts:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 04:47 AM
Hello @Community Alums ,
You can create an on change client script on "u_years" field and use the below script -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == 'billing_history'){
g_form.setValue('billing_info','u_annual'); //please check the field and option names
}
}
Also, if you want to execute this use case at server side you can create a After insert/update BR, configure the condition and set the field value accordingly.
If my answer solves your issue, please mark it as Accepted and Helpful based on the impact.