how to embed hyperlink for SCTASK num and for worknotes

nameisnani
Mega Sage

Hi Team , 

only for particular catalog

We want make this SCTASK00001 ( as a url ) if user clicks on that means it has to redirect to that sctask .

 

nameisnani_0-1701065846581.png

 

 

 

In the same SCTASK we are populating this message in worknotes also . in worknotes also it has to be url 

 

nameisnani_1-1701065846580.png

 

 

 

can anyone please provide me step by step solution to achieve . 

Please provide screenshot for better understandig

 

thanks in advance 

1 ACCEPTED SOLUTION

Just put quotes around sc_task

var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/'+'sc_task' + '.do?sys_id=' + gr.sys_id + '" target="_blank">' + workflow.scratchpad.task_number + '</a>[/code]';

 

Consider indicating the response as helpful and marking it as correct if it meets your needs.

View solution in original post

11 REPLIES 11

If you put 

href = 'sc_task.do?sys_id=-1'

 

Then it will take you to new record

sonamtiwari_0-1701069659873.png



you should pass something line sc_task.do?sys_id=<required task's sys id>

 

for a specific task, if you have number in scratchpad, then look up with that number to get the sysid of respective task and then pass it.

Consider indicating the response as helpful and marking it as correct if it meets your needs.

Hi @Aman Kumar S  @Sonam_Tiwari 

 

I am getting this below value please help me with code 

 

My requirment is to get the 1st - sctask number ( URL ) on the second Sctask worknotes . 

 

nameisnani_0-1701070119227.png

@Aman Kumar S @Sonam_Tiwari  Please provide code for more better understanding 

 

var gr = new GlideRecord('sc_task');
gr.addQuery('number',workflow.scratchpad.task_number); // assuming workflow.scratchpad.task_number has the 1st task's number in it
gr.query();
if(gr.next()){
var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/'+sc_task + '.do?sys_id=' + gr.sys_id + '" target="_blank">' + workflow.scratchpad.task_number + '</a>[/code]';
}

task.work_notes = url;


Adjust accordingly, haven't tested yet.

 

Consider indicating the response as helpful and marking it as correct if it meets your needs.

Hi @Sonam_Tiwari 

 

After updating with your code getting error . 

 

can this code we can use in workflow ? 

 

nameisnani_1-1701072141092.png

 

 

nameisnani_0-1701071865006.png

 

 

Please give code which i can update in workflow . so that we won't get any error . 

Just put quotes around sc_task

var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/'+'sc_task' + '.do?sys_id=' + gr.sys_id + '" target="_blank">' + workflow.scratchpad.task_number + '</a>[/code]';

 

Consider indicating the response as helpful and marking it as correct if it meets your needs.