dennysutanto
02/15/2025, 6:59 AMCeligo AI
02/15/2025, 6:59 AMAI generated answer (using internal Slack threads):Based on the conversations, to access a body field created by a User Event Script in an Advanced PDF, you can use the
beforeLoad
event type of the User Event Script to add a custom field to the form. This field will not be stored on the record but will be accessible in the Advanced PDF template.
Here is a sample code snippet that demonstrates this:
javascript
function beforeLoad(context) {
if (context.type === context.UserEventType.PRINT) {
let newField = context.form.addField({
id: 'custpage_my_field',
type: serverWidget.FieldType.TEXT,
label: 'My Custom Field'
});
newField.defaultValue = 'My Custom Value';
}
}
In the Advanced PDF template, you can then access this field using the following syntax:
html
${record.custpage_my_field}
Please note that the field is added to the form, not the record itself. Therefore, the value won't be stored anywhere if you plan to use it in the context EDIT.
******
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
02/15/2025, 6:59 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814072609
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80204
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799421906
Celigo AI
02/15/2025, 6:59 AM