Now Assist Skill issue

ritaaudi
Tera Contributor

Hi:
I created a Now Assist Skill that takes an incident record and creates a KB article with it via UI Action. Below is the Ui Action script. The problem is that it is not populating the short description of the article and the article body does not include the line breaks. Any idea how to do that? I am also pasting below the model output. 


UI Action script:

var inputsPayload = {};
// incident is a input of type: glide_record
inputsPayload['incident'] = {
  tableName: 'incident',
  sysId: current.getValue('sys_id'),
  queryString: ''
};

var capabilityId = 'bb99ba4147c76ed0661a527a516d4310';
var request = {
    executionRequests: [{
        payload: inputsPayload,
        capabilityId: capabilityId,
        meta: {
            skillConfigId: '80a97ec147c76ed0661a527a516d4355'
        }
    }],
    mode: 'sync'
};

try {
    var response = sn_one_extend.OneExtendUtil.execute(request) || {};
    var skillResponse = ((response["capabilities"] || {})[capabilityId] || {})["response"];
    var modelOutput = JSON.parse(skillResponse).model_output;
xyzabc(modelOutput);


    gs.addInfoMessage(JSON.stringify(skillResponse));
   
catch(e) {
    gs.error(e);
    gs.addErrorMessage('Something went wrong while executing skill.');
}
 
function xyzabc(modelOutput) {
var kno = new GlideRecord('kb_knowledge');
kno.text = modelOutput.trim();
//kno.text = modelOutput;
kno.kb_knowledge_base = 'dda8d698db20e200388ffbf9af9619b5';
kno.kb_category = '893d1b054f31120081a6acb14210c773';
kno.insert();
action.setRedirectURL(current);
 
action.setRedirectURL(kno);
}



This is the model output generated:

Info Message"{\"model_output\": \"**Knowledge Article: Drafting the April International Student Newsletter**\\n\\n**Introduction:**\\nThe incident involved creating a draft of the April edition of the International Student Newsletter (ISN). The task required assembling various components, including images and links, to produce a cohesive newsletter. The issue arose when certain elements, such as an image for the International Day of Dance event and an Eventbrite link, were not yet available. Additionally, a cropped and properly formatted version of a student photo was needed for the newsletter.\\n\\n**Cause:**\\nThe root cause of the incident was the lack of availability of certain essential elements required for the newsletter draft. These included an image for the International Day of Dance event, an Eventbrite link for the event, and a properly formatted student photo.\\n\\n**Resolution:**\\nTo resolve the incident, the following steps were taken:\\n1. The draft of the ISN was created, using the \\\"Safe Draft\\\" button to avoid publishing prematurely.\\n2. The order of pictures for the Announcements section was specified, with placeholders for the missing elements.\\n3. The team waited for the image for the International Day of Dance event to be created by Ekaterina and her student.\\n4. An Eventbrite link for the event was requested.\\n5. A cropped and properly formatted version of the student photo was requested for the Student Interview section.\\n6. The draft was finalized, pending the receipt of the missing elements.\\n\\n**Prevention:**\\nTo prevent similar incidents from occurring in the future, it is recommended to:\\n1. Ensure that all necessary elements, including images and links, are available before starting the drafting process.\\n2. Establish a clear timeline and deadline for the completion of all components.\\n3. Communicate effectively with team members and stakeholders to ensure that everyone is aware of their responsibilities and deadlines.\\n4. Consider creating a checklist of required elements to ensure that nothing is overlooked.\"}"

 

2 REPLIES 2

rpriyadarshy
Mega Guru

In Your Code where you are setting the KB Article Short Description?

 

Regards

RP

ritaaudi
Tera Contributor

OK, I did a substring of the model_output and assigned it to short description. No problem with short description now. 

But how do I get the body in html format so I have line breaks? What do you have to add in the skill prompt to do that. I think it should be in the skill prompt as opposed to UI Action. 

Appreciate your help!