- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:59 AM
Need help with some scripting...
This is the scenario -
On the asset table we have a reference field called Project Number (u_project_number) which references cmn_cost_center.
We also have two additional reference fields - Program Manager (u_program_manager) and Program Manager Department (u_program_manager_dept).
Program Manager (u_prog_manager_1) is only a reference field on the cmn_cost_center table.
The need:
Auto populate program manager and program manager department based on the project number.
Can anyone help?
Thank you in advance,
Rachel
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:33 AM
@rachelconstanti You need write two onChange script as follows.
Name: Project Number onChange
Table: alm_asset
UI Type: All
Type: onChange
Field: Project Number
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var getManager = g_form.getReference('u_project_number', referenceCallback);
function referenceCallback(costCenter) {
g_form.setValue('u_program_manager',costCenter.u_prog_manager_1);
}
}
Similarly write another script for Program manager field as follows.
Name: Program Manager onChange
Table: alm_asset
UI Type: All
Type: onChange
Field: Program Manager
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var getManager = g_form.getReference('u_program_manager', referenceCallback);
function referenceCallback(manager) {
g_form.setValue('u_program_manager_dept',manager.deparment);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:33 AM
@rachelconstanti You need write two onChange script as follows.
Name: Project Number onChange
Table: alm_asset
UI Type: All
Type: onChange
Field: Project Number
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var getManager = g_form.getReference('u_project_number', referenceCallback);
function referenceCallback(costCenter) {
g_form.setValue('u_program_manager',costCenter.u_prog_manager_1);
}
}
Similarly write another script for Program manager field as follows.
Name: Program Manager onChange
Table: alm_asset
UI Type: All
Type: onChange
Field: Program Manager
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var getManager = g_form.getReference('u_program_manager', referenceCallback);
function referenceCallback(manager) {
g_form.setValue('u_program_manager_dept',manager.deparment);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:45 AM
Thank you! This works perfectly.
I was missing this piece - costCenter.u_prog_manager_1
I tried just about everything but that