Insert knowledge article to the work notes of a catalog task

hugo_mattsson
Tera Contributor

Hi folks

Im trying to create an application request workflow with some dynamic instructions. The basic concept is this: A user requests an account to a new application using a form (catalog item) on the ESS portal. In this form the user selects wich application it want access to in a reference field (referencing the cmdb_ci_appl table). The workflow then creates a number of catalog tasks for service desk to setup the new account for the application. One of these tasks needs to contain detailed instructions for how to setup an account for the specific application selected by the user.


This customer has a ton of applications available for end users to order so the workflow need to be quite dynamic and the instructions cant be stored in the workflow itself, instead the instructions are stored as knowledge article in the kb_knowledge table.

The Application request form:

find_real_file.png

On the application form (in cmdb_ci_appl) there is a reference (to kb_knowledge) to a knowledge article that contains instruction for how to setup a new account for the application.

The Application form:

find_real_file.png

In the workflow (created on 'sc_req_item') I've tried the following code on the "create catalog task"- activity to insert the article referenced in the field on the application form to the tasks work notes. The variable used to reference the application table in the catalog item is called "specify_application", and the field on the application form referencing the KB article is called "u_user_creation_instruction". As you can see I've tried this using the getHTMLValue() method aswell... however it is not working, the article is not being pasted into the work notes of the catalog task.

find_real_file.png --------> find_real_file.png

My guess is that the issue has something to do with trying to retrive the html from the referenced article and inserting it into a journal field.

Any ideas   on how this can be achieved? Any help is greatly appreciated.

/// Hugo

1 ACCEPTED SOLUTION

Hi, I did



In the workflow activity to create the Catalog task I added the following lines of code:



To paste the referenced Knowledge article HTML in to the work notes of the catalog task:



task.work_notes = '[code]' + current.variables.specify_application.u_user_creation_instruction.text.getHTMLValue() + '[/code]';



And to insert a clickable Link to the referenced knowledge article in to the work notes of the catalog task:



task.work_notes = '[code]<a target="_blank" href="' + gs.getProperty('glide.servlet.uri') + '/kb_view.do?sysparm_article=' + current.variables.specify_application.u_user_creation_instruction.number + '">'+ current.variables.specify_application.u_user_creation_instruction.number +'</a> [/code]';



I hope it helps you out


View solution in original post

6 REPLIES 6

kostyakozachuk
Tera Expert

Hello Hugo,


Have you find the solution? I've got the same issue


Hi, I did



In the workflow activity to create the Catalog task I added the following lines of code:



To paste the referenced Knowledge article HTML in to the work notes of the catalog task:



task.work_notes = '[code]' + current.variables.specify_application.u_user_creation_instruction.text.getHTMLValue() + '[/code]';



And to insert a clickable Link to the referenced knowledge article in to the work notes of the catalog task:



task.work_notes = '[code]<a target="_blank" href="' + gs.getProperty('glide.servlet.uri') + '/kb_view.do?sysparm_article=' + current.variables.specify_application.u_user_creation_instruction.number + '">'+ current.variables.specify_application.u_user_creation_instruction.number +'</a> [/code]';



I hope it helps you out


Hi Hugo, this is great. Could you include a screenshot?


ravi_otpp
Tera Expert

Hi Hugo,



We're actually looking to implement something very similar. Essentially, our internal group which handles setting up permissions for applications wants to ensure that whatever instructions are shown in the KB article at the time of implementation is captured on the form (for audit purposes).



I want to accomplish this by surfacing a link to the KB article on the form as a convenient way for them to be able to access the most up to date instructions, and once they close off their task they system automatically pastes the contents of the respective KB article into the Activity stream to capture this info. in the request.



Just wanted to check if you were successful in implementing this yourself?



Thanks.