Hide the URL link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 04:03 AM
Hello experts,
I have a URL type field on a form and I am setting up the URL dynamically from the workflow.
Is there a chance like, once the user clicks on the url link, then the link has to be disappeared.
Because once the user clicks the link, the action is already performed and why to show that link again and make it clickable again and again?
Can you please help me
Regards,
Lucky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 04:53 AM
Hi ALi,
I tried with UI action first just to provide a link type in the Related links,
But my manager said he wants it on the form only.
Regards,
Lucky

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 05:31 AM
Hello @Lucky1
If it has more impact for business and really needed, you can create one formatter on your table and add that to your form view instead of the actual URL field. In the formatter, you can use UI macro where you will have complete control on HTML on what to show and client/server script as well to control the behavior. The logic will be little complicated, but you can refer any existing formatter to see how to read the current record fields and show the URL.
Here you can add on-click events in your HTML tags to achieve the use case.
One more solution would be as below, but here in the URL field on the form instead of the actual URL you will have to show UI page URL.
Logic:
1. Create one more URL/String type field or you can reuse any existing fields to store the actual URL. Update your URL to that field from workflow.
2. Create one UI page, say name as url_redirect_for_task, HTML is not required as this page will be just a processor. in page client script, read URL parameter sys_id(which we will pass to this page later) and query your table with that sys_id, then read the actual URL in one temp variable, then clear the URL fields and then update the record. After that redirect user to origional URL whose value is stored in the variable, this will be easy in client script. Above record query and update you can do using GlideAjax/Script include.
2. In another URL field (which is present in your form now), update URL as /url_redirect_for_task.do?sys_id=YOUR_CURRENT_RECORD_SYS_ID
When the form is opened, the URL field will be pointing to UI page with URL parameter with current record sys_id. When URL is opened, the script will query and update the current record using the sys_id and then redirect user to actual URL.
It will be little overkill if you ask me. There could be more simple solutions though.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 06:52 AM
Hi @Lucky1 ,
Hope you are doing great.
To achieve the desired functionality where the URL link disappears after the user clicks on it, we can implement a simple solution in the ServiceNow workflow.
- Create a new Boolean field (checkbox) on the form. Let's call it "Link Clicked."
- In the workflow, set up a trigger or condition to update the "Link Clicked" field to true once the URL link is clicked.
- Modify the visibility conditions of the URL field on the form. Set it to be visible only when the "Link Clicked" field is false. USe UI Policy for this to set the visibility of URL type field.
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 12:43 AM
Hi Riya,
Yes, doing great.
Thank you for your response,
It would be a good idea and I will accept this solution.
But, creating fields is not a good idea I guess.
Thanks a lot Riya for coming up and helping,
Have a good time
Regards,
Lucky

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 12:47 AM
Hello @Lucky1
Just for my understanding, how are/will you configure the trigger to check if the URL is clicked or not. The question was how to check if the URL is clicked, hiding/clearing field values is simple task.
Again this is just for my knowledge only.
Thank you,
Ali
Thank you,
Ali