How to hide the customer field on a sales invoice ...
# ask-stanley-ai
a
How to hide the customer field on a sales invoice prior to record load
c
AI generated answer (using internal Slack threads):
To hide the customer field on a sales invoice prior to record load, you can use a beforeLoad user event script. This script will allow you to manipulate the form and hide the field before it is loaded. Here is a sample code snippet that you can use as a reference:
Copy code
javascript
function beforeLoad(context) {
    if (context.type !== context.UserEventType.CREATE)
        return;

    var form = context.form;
    var field = form.getField({
        id: 'entity' // replace 'entity' with the id of the customer field
    });

    field.updateDisplayType({
        displayType: serverWidget.FieldDisplayType.HIDDEN
    });
}
In this code, the
beforeLoad
function is triggered before the form is loaded. It first checks if the context type is not 'CREATE', and if so, it returns without making any changes. If the context type is 'CREATE', it gets the form and the field you want to hide (in this case, the customer field). It then uses the
updateDisplayType
method to set the display type of the field to 'HIDDEN', effectively hiding the field. Please replace 'entity' with the actual id of the customer field on your sales invoice form. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835687399
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831112802
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811657429
Please provide your feedback on this answer.