Guide to Creating a Custom KB Generation SkillOverview When creating a KB Generation skill, there may be a need to introduce additional input fields. However, cloning an existing skill does not support modification of inputs. Additionally, the default UI action generated during deployment returns results using gs.addInfoMessage, which requires enhancement to enable KB article creation.This article provides a simplified example to demonstrate the approach. It is intended for guidance purposes and should not be considered a fully supported solution. Example Scenario This example demonstrates adding a custom field to the Incident table and using it as part of KB article generation.The custom field used in this scenario is a string field named u_football_team. Instructions Adding the Football Team field on the incident formPlease note that the Football KB UI action will only appear once these steps have been followed.Creating a new Article Template for this KB generation.go to Knowledge > Administration > Article Templates and create a new record The table name is automatically derived from the template name. For example, “Football Team” will result in the table name kb_template_football_team.In this example, four fields are added to the template. Since the display name is linked to the field name, a consistent technical naming convention is used for these fields. Creating the skill in the Now Assist Skill KitDescription and name of the skillPlease note that with this selection any authenticated user can use the skill and the skill will inherit the itil role for visibilityWriting the prompt from scratchSelecting the inputs for the skillOnly the Incident record is required, as the necessary data is retrieved using dot-walking.Please note the incident that will be used for testing the prompt Reviewing and Finish the setup of the skillDefault skill configuration Modifying the prompt to match our scenario You are a technical writer. Your mission is to write a knowledge article with the information gathered from the incident to help other people solve their similar issue quicker. The result should contain 3 things: Problem: This is the short description of the incident rewritten in a generic form Solution: This is how the incident has been solved and how new incident of the same type should be worked on. This part needs to be generic and cannot include any customer specific name or information. Any action from the support team should be name with The Agent and any action from the customer should be named The User. Football team: This information should reflect the Football Team field of the incident. If the field is empty, you should choose randomly each time between ["PSG", "Arsenal", "Bayern Munich", "Real Madrid"] You are optionally given the following details from the incident: Incident NUMBER: {{incident.number}} Incident SYS_ID: {{incident.sys_id}} Incident SHORT_DESCRIPTION: {{incident.short_description}} Incident DESCRIPTION: {{incident.description}} Incident PRIORITY: {{incident.priority}} Incident Football Team: {{incident.u_football_team}} Your answer MUST ALWAYS be a valid JSON similar to this one: { "incident": "The number of the incident we are working on", "parent": "The sys_id of the incident", "problem": "The problem as per the instructions above", "solution": "The steps to solve as per the instructions above", "football_team": "The best Football Team as per the instructions above" } Key Highlights of Prompt: Data retrieval is performed using dot-walking.The prompt is structured to generate two primary outputs: Problem and Solution.Additional logic is included for the Football Team field to demonstrate conditional handling.The LLM is explicitly instructed to always return the response in a JSON format. Saving the prompt and running the first test This step may require multiple iterations and refinements in a real-world scenario. For the purpose of this example, tool configuration, optimization, and evaluation steps are skipped, and the process proceeds directly to Section 4: Deployment and Skill Settings. Creating a UI action for the skillThe UI action will be revisited in a later step. For now, proceed with finalizing the prompt and publishing the skill.Finalizing the promptPublishing the skillPlease note that a quick green info message explains that the skill needs to be activated in the Now Assist Admin ConsoleActivating the skill in the Now Assist Admin ConsoleThe default values can be retained, and the skill can then be activated.Using the skill the first timePlease note that this is the result of clicking on the UI action Football KB and that this is the expected behavior as per the current UI action code.Updating the UI actionThe easiest way to go to the UI action is to use the link "Link to UI" action from the section 4. Deployment of the Skill Kit.Please note that the highlighted code is the part writing the Info Message.Adding the code to create the KB (function() { var inputsPayload = {}; inputsPayload['incident'] = { tableName: 'incident', sysId: current.getValue('sys_id'), queryString: '' }; var capabilityId = 'e55f70f03b588b10e3e5bfb036e45a6b'; var request = { executionRequests: [{ payload: inputsPayload, capabilityId: capabilityId, meta: { skillConfigId: '9e5fb0f03b588b10e3e5bfb036e45a46' } }], mode: 'sync' }; try { var response = sn_one_extend.OneExtendUtil.executeSecure(request) || {}; var skillResponse = ((response["capabilities"] || {})[capabilityId] || {})["response"]; if (!skillResponse) { gs.addErrorMessage('No response received from skill execution.'); action.setRedirectURL(current); return; } var parsed = JSON.parse(skillResponse); var output = JSON.parse(parsed.model_output); if (!output) { gs.addErrorMessage('Could not parse model output from skill response.'); action.setRedirectURL(current); return; } var createdKB = new GlideRecord("kb_template_football_team"); createdKB.initialize(); if (output.incident) createdKB.setValue("kb_source", output.incident); if (output.parent) createdKB.setValue("parent", output.parent); if (output.problem) { createdKB.setValue("kb_problem", output.problem); createdKB.setValue("short_description", output.problem); } if (output.solution) createdKB.setValue("kb_solution", output.solution); if (output.football_team) createdKB.setValue("kb_football_team", output.football_team); var newSysId = createdKB.insert(); if (newSysId) { action.setRedirectURL('kb_template_football_team.do?sys_id=' + newSysId); } else { gs.addErrorMessage('KB record insert failed.'); action.setRedirectURL(current); } } catch (e) { gs.error('NASK KB Creation Error: ' + e.message); gs.addErrorMessage('Something went wrong while executing skill: ' + e.message); action.setRedirectURL(current); } })(); Creating the KB and redirecting to itPlease note that this is the result of clicking on the UI action with the code from step 17.