Dynamic URL in 'Annotation' on a form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2015 11:16 PM
Hi, there
I have an URL in an 'Annotation' on a form, which opens another web site in a new window/tab. I wish to append a parameter to the URL so that it opens the target web site with a string in a search field on that site automatically. Here below is the hard coded href in the Annotation;
Visit the <a href="http://abr.business.gov.au/SearchByAbn.aspx?SearchText=84726886658" target="_blank">Visit ABN Lookup Site</a> to verify the ABN and Company Details.
The field on the form is 'u_abn' and I wish to pass this variable as parameter in the URL (in the above example the value is 84726886658). Assume one can do this with javascript in the annotation, but I am not sure how to achieve this. Anyone who can provide me with example code that will work in an Annotation?
Many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2015 02:00 PM
I am not sure using annotations is the best approach in this case. It should be easier to achieve this with a simple info message. You can read the value from 'u_abn' field and build the URL in a 'display' business rule and use addInfoMessage() to display the text with the hyperlink to the user.
Business Rules - ServiceNow Wiki
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2015 06:33 PM
Thanks for your reply, @Slava!
What I ended up doing is to generate the url with a client script and pass it into a read-only field on the form (Field Type = URL)
Cheers
Leon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 08:36 PM
You can have a dynamic annotation, and therefore a dynamic link in an annotation. Set the annotation to the text below USING FORM LAYOUT:
Visit the <a href="http://abr.business.gov.au/SearchByAbn.aspx?SearchText=${current.u_abn}" target="_blank">Visit ABN Lookup Site</a> to verify the ABN and Company Details.
Form designer will try and strip the HTML tags but Form Layout won't.
Note: this pulls from current.u_abn which is the value that was last saved to the database. It will not reflect changes made to the form field if Save has not been clicked yet.
cheers,
Howard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2018 01:20 PM
This was tremendously helpful, thank you!!