can a user event script run when I print through P...
# ask-stanley-ai
a
can a user event script run when I print through Print Checks & Forms
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that a User Event Script can indeed be triggered when printing a transaction. However, the changes made in the script may not be reflected in the printout. This is because the changes made in the
beforeLoad
event of the User Event Script are not stored in the record. One possible workaround suggested is to add a custom field to the record in the
beforeLoad
event that is not stored on the record but would be accessible in an advanced print template. This field could then be referenced in your printout. Here is a code snippet provided in the conversation that demonstrates this:
Copy code
BeforeLoad UserEvent only for PRINT
....
let jsonData = {
    new_layout : 0,
    hasJob: false,
    hasTask: false,
    hasEmpl: false........
    jsonArray: jsonArray,            

newRecord.setValue({
    fieldId: 'custbody_rdata_inline_html',
    value: JSON.stringify(jsonData)
});
And later in AdvancedPDF Template
Copy code
<#assign my_json = record.custbody_rdata_inline_html?eval>
Please note that this is a workaround 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. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826293945
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82598877
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824035645
Please provide your feedback on this answer.