- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:34 AM
Hi,
We are generating HR document templates using BR when a record producer is submitted.
PDF are attaching to the case, but the variables/ fields configured on the templated are not displaying on the generated PDF.
${subject_person.company}
${subject_person.location}
DOB: ${variables.date_of_birth_dach}
First two are HR case fields and DOB is a record producer variable. None of them are displayed
How can we fix this?
Solved! Go to Solution.
- Labels:
-
Tokyo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:53 AM
although ServiceNow says syntax is ${variables.variableName}, but it's sad that it doesn't work
1 other member also tried the same and it didn't work, I provided solution for that
Is it possible to add record producer variables to HR Document Templates
You can use document template script for that
use template script and bring the variable data and use it
(function runTemplateScript(target /*GlideRecord for target task*/ , docTemplate /*GlideRecord for doc template*/ ) {
//Add your code here to return the dynamic content for template
var gr = new GlideRecord("your table name");
gr.addQuery("sys_id", target.sys_id);
gr.query();
if (gr.next()) {
return gr.variables.variableName;
}
})(target, docTemplate);
${template_script:fetch_variable_value} -> include in the body of template
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:53 AM
although ServiceNow says syntax is ${variables.variableName}, but it's sad that it doesn't work
1 other member also tried the same and it didn't work, I provided solution for that
Is it possible to add record producer variables to HR Document Templates
You can use document template script for that
use template script and bring the variable data and use it
(function runTemplateScript(target /*GlideRecord for target task*/ , docTemplate /*GlideRecord for doc template*/ ) {
//Add your code here to return the dynamic content for template
var gr = new GlideRecord("your table name");
gr.addQuery("sys_id", target.sys_id);
gr.query();
if (gr.next()) {
return gr.variables.variableName;
}
})(target, docTemplate);
${template_script:fetch_variable_value} -> include in the body of template
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 08:28 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 12:08 AM
Hi @Ankur Bawiskar , thanks for sharing the approach for record producer variables.
Even the fields on the case form are not getting displayed like opened for or category.
How can we fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 12:39 AM
it should work fine
share your HR document template config screenshots
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader