- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 07:44 AM
We are using the header annotation on our form. However the annotations are not showing in the portal form. Is there something I need to add to the page/widget in order for the annotations to show in the portal?
Thank you,
Stacy
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 07:53 AM
Hi Stacy,
Displaying of annotations on the form isn't supported in form widget of service portal. As far I know, one should not expect that the feature will be implemented in the future too. To understand why it's so, it's important to remark, that an annotation is very close to UI Macro and so, it can be more complex as simple plain text from your example.
To make your example multilinguale you should use the following text of annotation
${gs.getMessage("Operational/Logistics")}
instead of the text "Operational/Logistics" only. It shows the complexity of the problem. If you would examine texts used in annotations of standard ServiceNow instance you will find annotations like
<span id="cawt_annotation">
${new OnCallEscalationUtil().getCatchAllWaitTimeAnnotation()}
</span>
or like
${ALLOW_JELLY:gs.getMessage("Specify the data ...")}
(I reduced long text on the message till "...").
Thus, the text an annotation could be not only a text or a HTML, but it could contains code fragments, which have to be executed on the server side. Because of that the implementation of annotation support in common case is very complex. I guess, that because of that the feature is dropped in Service Portal.
If you really need to include some texts or HTML fragments on form and you need to display it on both desktop and Service Portal, than I could suggest you to use UI Macros instead of Annotations. Inside of UI Macro code it's possible to place common HTML fragments, which includes code fragments executed on the server side. By defining of UI Formatter for a table you makes UI Macro available for placing on Form of the table. Additionally, one can create small Service Portal widget, which makes the same job, what do UI Macro.
Finally, one needs add an entry in "Service Portal UI Formatter" table [sp_ui_formatter], which informs Service Portal, which Service Portal widget should be displayed on a form instead of UI Macro. The entry will maps your custom UI Macro to your custom widget.
I understand that the solution with UI Macro and widget is relatively complex and it's oversized if you just need to place simple text or HTML text, but I see no other solution of your problem.
Macro does not work on portal.
Write your macro script in service portal widget and then you can call the widget on your macro type variable.
Also, refer to this thread:
https://community.servicenow.com/community?id=community_question&sys_id=6edd674edb3c5b402e247a9e0f9619a3
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 07:53 AM
Hi Stacy,
Displaying of annotations on the form isn't supported in form widget of service portal. As far I know, one should not expect that the feature will be implemented in the future too. To understand why it's so, it's important to remark, that an annotation is very close to UI Macro and so, it can be more complex as simple plain text from your example.
To make your example multilinguale you should use the following text of annotation
${gs.getMessage("Operational/Logistics")}
instead of the text "Operational/Logistics" only. It shows the complexity of the problem. If you would examine texts used in annotations of standard ServiceNow instance you will find annotations like
<span id="cawt_annotation">
${new OnCallEscalationUtil().getCatchAllWaitTimeAnnotation()}
</span>
or like
${ALLOW_JELLY:gs.getMessage("Specify the data ...")}
(I reduced long text on the message till "...").
Thus, the text an annotation could be not only a text or a HTML, but it could contains code fragments, which have to be executed on the server side. Because of that the implementation of annotation support in common case is very complex. I guess, that because of that the feature is dropped in Service Portal.
If you really need to include some texts or HTML fragments on form and you need to display it on both desktop and Service Portal, than I could suggest you to use UI Macros instead of Annotations. Inside of UI Macro code it's possible to place common HTML fragments, which includes code fragments executed on the server side. By defining of UI Formatter for a table you makes UI Macro available for placing on Form of the table. Additionally, one can create small Service Portal widget, which makes the same job, what do UI Macro.
Finally, one needs add an entry in "Service Portal UI Formatter" table [sp_ui_formatter], which informs Service Portal, which Service Portal widget should be displayed on a form instead of UI Macro. The entry will maps your custom UI Macro to your custom widget.
I understand that the solution with UI Macro and widget is relatively complex and it's oversized if you just need to place simple text or HTML text, but I see no other solution of your problem.
Macro does not work on portal.
Write your macro script in service portal widget and then you can call the widget on your macro type variable.
Also, refer to this thread:
https://community.servicenow.com/community?id=community_question&sys_id=6edd674edb3c5b402e247a9e0f9619a3
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 07:57 AM
Thank you, not sure I want to go that far. I will make it in to a record producer which will allow me to display title in the container start which will be similar to what I am trying to accomplish.