Need to make a variable as hyperlink in business rule

Talha3
Kilo Guru

@Allen Andreas 

 I have a requirement to make a variable value "Number" to be added to work notes(this part is working)

Second part is whenever user clicks on "demand number" from work notes they should be redirected on the service portal where this demand task exists so that non ITIL users can view the demand task.

Attached is the screenshot of business rule script:

find_real_file.png

 

find_real_file.png

As shown above need to make this Demand task number a hyperlink.

1 ACCEPTED SOLUTION

To create a hyperlink in the work notes, you can use the following:

gr.work_notes = '[code]<a href="' + gs.getProperty("glide.servlet.uri") + 'sp?id=ticket&table=dmn_demand&sys_id=' + current.getValue("sys_id") + '">' + current.getValue("number") + '</a> [/code]' + '\n Short Description: ' + current.getValue("short_description");

Keep in mind, also, for the above, you'd have to allow the [code] tag within your journal fields via this system property being set to: true

glide.ui.security.allow_codetag

You'd need to replace "sp" above in the code with the abbreviation for your service portal that you want to direct them to (if different).

Example of result:

find_real_file.png

and clicking link goes to:

find_real_file.png

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

7 REPLIES 7

Talha3
Kilo Guru

I would only need current.number field to be a hyperlink. This script makes converts everything into a hyperlink.


Secondly how can I add the base url value, I have added a URL but this always redirects to a wrong URL.

Please reply to the above mentioned queries.

To create a hyperlink in the work notes, you can use the following:

gr.work_notes = '[code]<a href="' + gs.getProperty("glide.servlet.uri") + 'sp?id=ticket&table=dmn_demand&sys_id=' + current.getValue("sys_id") + '">' + current.getValue("number") + '</a> [/code]' + '\n Short Description: ' + current.getValue("short_description");

Keep in mind, also, for the above, you'd have to allow the [code] tag within your journal fields via this system property being set to: true

glide.ui.security.allow_codetag

You'd need to replace "sp" above in the code with the abbreviation for your service portal that you want to direct them to (if different).

Example of result:

find_real_file.png

and clicking link goes to:

find_real_file.png

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

@Allen Andreas thanks, it worked 🙂