auto populate one field based on other 3 fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 03:33 AM
Hello Exports,
We want to auto populate based on assigned to field on asset table.
cost center ,department and location.
Requirment
1.If assigned to is empty "cost center ,department and location" fields should be empty.
2.If not should populate values based on the assigned to .
I have tried below onchange client script but not working pls correct me.
Table =" alm_asset"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:09 AM - edited 11-22-2023 04:10 AM
Hi,
In 1st line itself you say
, so it wont clear your data. Keep it as -
And I would advise to write to script include to fetch the values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 09:29 AM
Hi @sonali panda1 @Samaksh Wani ,
I have found below mentioned onchange client script is updating the fields.
can we achieve clear value using this code ? or else pls share any sample script for script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 09:47 PM - edited 11-22-2023 09:48 PM
Hello @akin9
For Clearing Values you are checking assigned to empty, that will remain at first only.
You have write one onLoad() Client Script for this.
function onLoad(){
var x=g_form.getValue('assigned_to');
if(x==''){
g_form.clearValue('department');
g_form.clearValue('cost_center');
g_form.clearValue('location');
}
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 11:12 PM
Hi @akin9 ,
If assigned to is empty you should want clear the three fields for the you can write ui policy
condition assigned to is empty
and in the script you can wirte
g_form.clearValue('department'); g_form.clearValue('cost_center'); g_form.clearValue('location');
If assigned to not empty
for that you can mention auto populat depend field based on that you can kept the conditons.
use auto populate by dot walking. Like below for three fields. And write the ui plolicy also
ui policy
below is the ui policy script
Please let us know still you have any dought
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 09:22 PM
Hello @Sirri @Samaksh Wani
Thanks for the support!
I have created a onchange client script for "alm_hardware" table.
and its working fine now.