- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 04:48 AM - edited 08-02-2024 04:50 AM
Hi all.
I've created a new Journal Input field called 'Vendor comments' on the Task table. I've nested the new field with the Comments and Work notes fields on the Incident form. I only want the field to be visible when a selected Vendor is an integrated vendor. The Vendor field on the Incident form is a reference field to the core_company table and "integrated vendor" is determined by a true\false field called 'u_integrated_v2' on that record:
I have created a UI Policy to show\hide Vendor comments, however, it doesn't work when the field changes, only when the page is loaded. Example, on a new record, the field is hidden. When I select an integrated vendor, it should appear, but it does not:
When I save the record, the field appears as it should:
Furthermore, changing the Vendor at this point should hide the field, but this does not work either until the record is once again saved and the form relaoded.
Here is my UI Policy:
I also created an onChange Client Script to try and manage it that way, but that doesn't work either:
I know you can change journal field behaviour using UI Policies because Work notes becomes mandatory when you change the Assignment group, so I don't see why I can't show\hide my new Vendor comments field. Any thoughts?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 11:32 AM
You gave me an idea and I've got it working. I used setDisplay instead of setVisible and it works as desired:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var vendor = g_form.getReference('u_vendor');
if (vendor.u_integrated_v2 == 'true') {
g_form.setDisplay('u_vendor_comments', true);
} else {
g_form.setDisplay('u_vendor_comments', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 06:46 AM
I just wanted to clarify a few things before answering this:
1. The u_integrated_v2 field is on the core_company table, right?
2. The Vendor field on the Incident form is a reference field to the core_company table.
3. Your requirement is to make the Vendor Comments field visible when the user changes the Vendor field on the Incident form, correct? So, it will check if u_integrated_v2 is true on the core_company table for that vendor. Only then should Vendor Comments be visible; otherwise, it should not.
Please check and let me know if my understanding of your requirement is correct so that I can help you out.
Thanks,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 09:04 AM
Hi Krushna, that summary is correct, yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 07:01 AM
Seems the onChange client script you have should work. You can add:
var intVar = vendor.u_integrated_v2;
alert('u_integrated_v2 = ' + intVar);
to test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 09:04 AM
Hi Bert. I did this and can confirm the Client Script pops the alert.