- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 12:48 PM
Here is the code I have that verifies the value is synced. I added the if and for statement because it work 90% of the time and the other 10% failed. I think it might be a timing issue so I added the for and if statements however now it hangs - Thoughts?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var cc = g_form.getReference('cost_center', populateReqForDetails);
function populateReqForDetails(cc) {
for (i = 0; i < 5; i = i++) {
if (cc == 'u_cost_center_code') {
return;
} else {
g_form.setValue('u_cost_center_code', cc.code);
}
}
}
//Type appropriate comment here, and begin script below
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 08:17 AM
From any Department record, select Configure > Form Layout
From there, click the Cost center [+] field, then select the top icon in the middle to expand the Cost center [+] to show all fields on the Cost Center form.
Select the Code field and add it to your form.
You probably should make the field read only with a UI Policy so users do not change the Cost center record by mistake:
- Make Code Read Only
Table: Department [cmn_department]
Short description: Make Code Read Only
Description: Makes the Code field from the Cost Center record read only
Order: 100
Global: true
Reverse if false: true/false
On load: true/false
Inherit: true/false
Create a UI Policy Action and expand the Cost center field to get at the Code field
Make the UI Policy Action for the Code field to be Read only
Let me know if you still need assistance,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 09:23 AM
just verifying same applies - this is not a catalog item - it is a custom field on the department table syncing up with a value in the cost code table.????

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 10:20 AM
I need to better understand what is built. I am hearing the Department table and the Cost Center table being mentioned. I am guessing that the Department table contains the custom field Cost center code [u_cost_center_code] as well as a reference field called Cost center [cost_center]. I am also guessing that the Cost center code field is on the Cost Center table as well.
You have a choice as to which direction you wish to go depending on what your user expectations are.
- If the expectation is to show the code on the form, you can abandon the string field on the Department form and create a new field that points to the Cost center code field from the Cost center table. No need to do any scripting since it is pointing to the actual field on the Cost Center table through the Cost center reference field.
- If the expectation is to be able to find the Cost center record from the Cost center code, then using type ahead is what to do. You just need to change the attributes on the Cost center reference field on the Department table.
Let us know which direction you chose and if you need assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 10:29 AM
The Cost Center table has 2 OOB fields( Name and Code)
The Department table has 1 OOB field (Cost Code which brings in the value of Name field from Cost Center and 1 Custom field named u_cost_center_code.
I am trying to bring in the Code field value from Cost Center table to the custom field as the users want to see the actual code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 07:33 AM
I believe choice #1 is what I am looking for.
The Department table has 1 OOB field (Cost Code which brings in the value of Name field from Cost Center and 1 Custom field named u_cost_center_code. I want to display the code on the department form and be able to put it in the Department list view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 08:17 AM
From any Department record, select Configure > Form Layout
From there, click the Cost center [+] field, then select the top icon in the middle to expand the Cost center [+] to show all fields on the Cost Center form.
Select the Code field and add it to your form.
You probably should make the field read only with a UI Policy so users do not change the Cost center record by mistake:
- Make Code Read Only
Table: Department [cmn_department]
Short description: Make Code Read Only
Description: Makes the Code field from the Cost Center record read only
Order: 100
Global: true
Reverse if false: true/false
On load: true/false
Inherit: true/false
Create a UI Policy Action and expand the Cost center field to get at the Code field
Make the UI Policy Action for the Code field to be Read only
Let me know if you still need assistance,