Good evening all, have an issue that is making me pull my hair out (because I've forgotten how to make it work correctly!).
Have a field called "Oppstatus" that is a drop box with several values. (Open, Quoted, Approved, etc)
Have another field called "Probability" that is a drop box with percentages (0%, 10%, 20%, etc)
Whenever someone selects the value "Quoted", would like the percentage change to 30%, or if changed to "Approved", change to 90% - however, would still like the ability for the operator entering the data to manually override the percentage.
I think jquery is the way to go; but my brain is just not firing on all cylinders...
Change Field Value based upon another value....
-
- Posts: 6
- Joined: 2024-02-17 00:40
- Marcelo Vitoria
- Veteran Member
- Posts: 102
- Joined: 2016-10-11 12:08
Re: Change Field Value based upon another value....
In the table where the "Oppstatus" field is, also insert the percentage field that you need to display.
When the user selects the value Open, Cited, Approved, etc., in the Probability field you configure it as a lookup field with autofill checked to pull the percentage value from the "Oppstatus" table, but this lookup field cannot be edited separately.
I hope this helps.
When the user selects the value Open, Cited, Approved, etc., in the Probability field you configure it as a lookup field with autofill checked to pull the percentage value from the "Oppstatus" table, but this lookup field cannot be edited separately.
I hope this helps.
Marcelo Vitoria
Coding since 1982 !
Basic Sinclar - Clipper - Visual Foxpro - VB6 - PHP
AppGini 24.18 - AdminLTE - SPM
https://www.workspaceservices.com.br/eng
Coding since 1982 !

Basic Sinclar - Clipper - Visual Foxpro - VB6 - PHP
AppGini 24.18 - AdminLTE - SPM
https://www.workspaceservices.com.br/eng
-
- Posts: 6
- Joined: 2024-02-17 00:40
Re: Change Field Value based upon another value....
Marcelo, thanks... That unfortunately doesn't allow the user to "override" the percentage. I built something like this a while back for product additions to quotes; where it would plug in "default" prices based upon the lookup, but would allow the user to override if we had special pricing for a particular reason...
Re: Change Field Value based upon another value....
Hi,
it would be good to know what kind of dropdown you have. Is it a lookup, or an option list.
Logically you can register for the on change of the Oppstatus and based on the new fieldvalue you can trigger a change to the Probaility.
it would be good to know what kind of dropdown you have. Is it a lookup, or an option list.
Logically you can register for the on change of the Oppstatus and based on the new fieldvalue you can trigger a change to the Probaility.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
- Posts: 6
- Joined: 2024-02-17 00:40
Re: Change Field Value based upon another value....
The source dropdown is an option list; not a lookup.
Re: Change Field Value based upon another value....
Hi,
you may try this code in the hooks/TABLENAME-dv.js
Like this the dropdown will adjust to 10% for open and 90% for approved, but remains editable.
you may try this code in the hooks/TABLENAME-dv.js
Code: Select all
function switch_probability(prob) {
$j('#Probabilit').select2().val(prob).trigger('change');
}
$j(function() {
$j('#Oppstatus').on('change',function(e) {
val=e.added.id;
switch (val) {
case 'Open':
switch_probability('10%');
break;
case 'Approved':
switch_probability('90%');
break;
}
})
})
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.