user event script to get customform number
# ask-stanley-ai
k
user event script to get customform number
c
AI generated answer (using internal Slack threads):
In order to get the custom form number in a User Event script, you can use the
record
object's
getValue
method. Here is a sample code snippet:
Copy code
javascript
function beforeLoad(context) {
    if (context.type !== context.UserEventType.CREATE)
        return;

    var form = context.newRecord.getValue({
        fieldId: 'customform'
    });

    log.debug("Form", form);
}
This script will get the internal ID of the custom form used in the record. Please note that this script should be deployed as a User Event script and should be triggered on the 'Before Load' event. However, please note that you cannot change the custom form in the 'Before Load' event as it's too late to change it at that point. If you need to change the custom form, you might need to do it in a 'Before Submit' event or find a workaround, possibly using a custom record or similar. Also, be aware of creating an infinite loop if you're redirecting to a new Sales Order creation page with the same script running on it. ****** 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.820800781
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80645752
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803222656
Please provide your feedback on this answer.