darrenhillconsulting
11/05/2024, 9:32 PMCeligo AI
11/05/2024, 9:32 PMAI generated answer (using internal Slack threads):Based on the conversations, if a field's DisplayType is set to HIDDEN in a beforeLoad User Event script, it cannot be changed to SHOW in a Client Script. Once a field is hidden by a User Event script, it cannot be made visible again by a Client Script. However, there are some workarounds suggested in the conversations: 1. Instead of hiding the field in the User Event script, you can disable it. Then, in the Client Script, you can enable or disable it as needed. 2. Another approach is to set the field to be visible by default, and then hide it in the pageInit function of the Client Script. This way, the field can be shown or hidden dynamically in the Client Script. Here is a sample code snippet for the second approach:
javascript
function updateFieldDisplayType(record, fieldName, displayType) {
var field = record.getField({
fieldId: fieldName
});
if (field) {
field.updateDisplayType({
displayType: displayType
});
}
}
function fieldChanged(context) {
var record = context.currentRecord;
var fieldName = context.fieldId;
if (fieldName === 'custpage_field_to_update') {
updateFieldDisplayType(record, 'custpage_field_to_change_display', 'normal');
}
}
Remember, these are workarounds and may not work in all scenarios.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
11/05/2024, 9:32 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.882399678
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.875859797
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.873809159
Celigo AI
11/05/2024, 9:32 PM