- 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-23-2022 12:53 PM
If this is client-side, I would use an AJAX call to do the heavy lifting rather than using getReference. Let us know if you need assistance in building.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 01:15 PM
Tell me more if you would be so kind.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 01:37 PM
Before I begin, I need to better understand the end result of your design. Based upon what your subject indicates you are synchronizing records between different tables. Unsure if what you are doing is populating fields in one form from another, or if you are changing records on other tables based upon a change from the original table. I do not want to misdirect what to do if it can have a different solution.
Please let us know what you have built so far, how you expect it to work, and how it is failing so we can solution accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 07:04 AM
I have a custom field in cmn_department that I am grabbing the corresponding cost code in and inserting it if the department name is changed.