display a custom html field with a message when th...
# ask-stanley-ai
n
display a custom html field with a message when there is an open quote for that customer on a customer record
c
AI generated answer (using internal Slack threads):
To display a custom HTML field with a message when there is an open quote for a customer on a customer record, you can use a combination of SuiteScript and workflows. Here's a general approach: 1. Create a custom field on the customer record. This field will hold the HTML content that you want to display. Make sure to set the type of this field to 'Free-Form Text' or 'Rich Text' and check the 'Store Value' checkbox. 2. Create a User Event script that will run on the Quote record. This script will check if the quote is open and if so, it will update the custom field on the related customer record with the HTML content. Here's a sample code for the User Event script:
Copy code
javascript
function afterSubmit(context) {
    if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT) {
        return;
    }

    var quoteRecord = context.newRecord;
    var status = quoteRecord.getValue('status');

    if (status === 'Open') {
        var customerId = quoteRecord.getValue('entity');
        var customerRecord = record.load({
            type: record.Type.CUSTOMER,
            id: customerId
        });

        customerRecord.setValue('custentity_your_custom_field', 'Your HTML content');
        customerRecord.save();
    }
}
3. Create a workflow that will run on the Customer record. This workflow will have a single Set Field Value action that will set the value of the custom HTML field to an empty string when the record is viewed. This will ensure that the message is cleared after it has been viewed. 4. Finally, modify the customer record form to include the custom HTML field. You can place this field in a prominent location so that it's easily visible when viewing the record. Remember to replace 'custentity_your_custom_field' with the actual ID of your custom field and 'Your HTML content' with the actual HTML content that you want to display. ****** 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.825816929
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817501485
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811275482
Please provide your feedback on this answer.