I want to add the clickable record link in the worknote

Sudhir10
Tera Contributor

Hello

 

I want to add the clickable link of the newly created record through an UI Action in the worknote. How we can write a code for this?

 

Thanks.

2 ACCEPTED SOLUTIONS

Prathamesh G
Kilo Sage
Kilo Sage

Hello @Sudhir10,

 

I have implemented the same functionality in my previous use cases. Below I am sharing the code for that. 

 

//Create a Request from HR Case
var grRequest = new GlideRecord('sc_request');
grRequest.initialize();
grRequest.opened_by = gs.getUserID(); //set Opened by field on Request to the current user
grRequest.requested_for = grCase.opened_for; // set Requested by field on Request
grRequest.insert();

//create RITM from Request
var grRITM = new GlideRecord("sc_req_item");
grRITM.initialize();
grRITM.request.requested_for = grCase.opened_for; //set Requested for field on RITM
grRITM.cat_item.setDisplayValue(grCase.hr_service.getDisplayValue()); //set Item field on RITM
grRITM.assignment_group.setDisplayValue(grCase.assignment_group.getDisplayValue()); //set Assignment Group field on RITM
grRITM.assigned_to.setDisplayValue(grCase.assigned_to.getDisplayValue()); //set Assigned to field on RITM
grRITM.parent.setDisplayValue(grCase.number.getDisplayValue()); //set Parent field on RITM
grRITM.request.setDisplayValue(grRequest.number.getDisplayValue()); //set Request field on RITM
grRITM.state = '9'; //set State to New
grRITM.approval = 'approved'; //set Approval Status field on RITM
grRITM.stage = 'Approved';
grRITM.priority = grCase.priority; //set Priority field on RITM
grRITM.description = description; //set Description field on RITM

var hrLink = '<a href="/' + task_table_name + ".do?sys_id=" + task_sys_id + '">' + grCase.number + '</a>'; //Link for the HR case with number
grRITM.work_notes = "[code]Record created from HR Case " + hrLink + '[/code]'; //Add worknote to the RITM ticket with the HR case number attached with link
var ritmID = grRITM.insert();
var link = '<a href="/sc_req_item.do?sys_id=' + ritmID + '">' + grRITM.number + '</a>'; //Link for the RITM ticket
grCase.work_notes = "[code]Requested item " + link + " has been created[/code]"; //Add worknote to the HR case ticket with the RITM number attached with link

 

Please use this logic for your requirement. You can modify it as per your requirement. 

 

If the above solution resolve your issue, Please mark the solution as 'Accepted Solution' and also mark it as 'Helpful'.

 

Thank You.

View solution in original post

Hi @Sudhir10 

okay, I got your point.

Please refer to the following video to understand how clickable links can be added to the work notes: https://www.youtube.com/watch?v=bB76PWXWBXI 

Thanks
Maik

View solution in original post

7 REPLIES 7

Maik Skoddow
Tera Patron
Tera Patron

Hi @Sudhir10 

unfortunately, it is not clear what your question is about. Please provide more words and also a screenshot to help us understand you better.

Thanks
Maik

Hello @Maik Skoddow,

 

I have created one UI action to create record in another table. Once the record is created in another table, I am adding the worknote indicating the new record (with record number) is created. So want that 'Number' to be clickable after it is added into the worknote.

 

Thanks

Hi @Sudhir10 

okay, I got your point.

Please refer to the following video to understand how clickable links can be added to the work notes: https://www.youtube.com/watch?v=bB76PWXWBXI 

Thanks
Maik

Hello @Maik Skoddow,

 

Thank you for sharing the youtube link for my question.