For the standard note types the language variable text is set successfully so it appears in the prefix-content:
<div class="note note" data-attr-type="note">
<span class="prefix-content">Note: </span>This is a note of type 'note'</div>
But for @TyPe=other @othertype I get:
<div class="other note" data-attr-othertype="respiratory-warning" data-attr-type="other">
<span class="prefix-content">Other: </span>This is a note of type 'other' with othertype set to respiratory-warning</div>
The prefix-content is related to @TyPe=other and not @othertype.
Is there a way to set the language variable text for each @TyPe=other @othertype combination?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Thank you for your query.
I further checked and found that dynamic prefixing for @othertype values is not supported currently.
I will be raising a Jira ticket requesting the implementation.
Thanks
Prashant
Hi Mike,
This can be achieved by using following javascript in pdf template. Please feel free to edit it further to achieve desired result.
a. Add following javascript to resources for pdf template.
b. Use the added javascript in content div of page layout for the pdf template (as mentioned below).
c. Enable Javascript at preset level and select above template to preset.
d. Generate the pdf.
//Javascript
window.addEventListener('DOMContentLoaded', function () {
const elements = document.querySelectorAll('div.other.note[data-attr-othertype]');
elements.forEach(element => {
const prefixSpan = element.querySelector('span.prefix-content');
if (prefixSpan) {
prefixSpan.textContent = element.getAttribute('data-attr-othertype') + ': ';
}
});
});
//Add js to content div in Page Layout
<div data-region="content">
<script src="a.js" type="text/javascript"></script>
</div>
Please let me know if this works for you.
Regards,
Tulika Aggarwal
@Mike-E Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes