case_question input variable in Create HR Case topic block

Ritika Saran4
Kilo Contributor

Hi All,

Can someone please help me to understand what to pass in case_question input for Create HR case topic block.

I'm trying to test the topic block Create HR Case. I've duplicated the OOB one since I wanted to add few custom messages. But I'm not sure how to test with case_question input. What value I need to pass from my calling topic.

 

Thanks in advance

@Ankur Bawiskar 

@Mark Roethof 

Any help will be highly appreciated

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you share the exact step with screenshot

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I have created a custom topic - test topic block [screenshot 1] to call a topic block - Create HR Case ESC [screenshot 2] which is a clone OOTB topic block - Create HR Case .

The topic block 'Create HR Case' has case_questions as the input variable that needs to be passed from calling topic 'test topic block'. I'm able to set the other inputs from calling topic but I'm not sure what kind of input I should ask the user to provide for case_questions in test topic so that it can be passed to Create HR Case topic block. If I'm passing any text user input from test topic to case_questions then my OOB script to generate the HR Case is failing [The log in line 16 is not coming] [screenshot 3].

1find_real_file.png

2.find_real_file.png

3.

find_real_file.png

 

Hi,

you have already provided inputs

what is not working?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Thanks for your response.

When I'm passing case options to my topic block then the HR Case is not getting created.
However, if I don't pass anything in case questions and make case_question input as non mandatory and modify the script to only pass additional comments as below :

 

(function execute() {
var hrServiceId = vaInputs.hr_service.getValue();
var caseTable = vaInputs.case_table.getValue();
var questions = [];
if (!gs.nil(hrServiceId) && !gs.nil(caseTable) ) {
// questions = JSON.parse(vaInputs.case_questions);

var additional_comments = {
question: "Please provide additional comments for your case.",
name: "additional_comments",
answer: vaInputs.additional_comments,
raw: vaInputs.additional_comments,
answerDisplayValue: vaInputs.additional_comments
}
questions.push(additional_comments);
gs.info("rs = 111")
var caseDetails = new sn_hr_va.hr_ChatbotUtils().createCaseWithHRService(hrServiceId, caseTable, questions);
vaVars.case_sysid = caseDetails.sysid;
if (vaVars.case_sysid) {
vaVars.is_case_created = true;
vaSystem.attachRecordToConversation(caseTable, caseDetails.sysid);
}

var gr = newGlideRecord('sn_hr_core_case');
if (gr.get(vaVars.case_sysid)) {
gr.work_notes = vaSystem.getTranscript();
gr.update();
}
}
})()
Then the HR case is getting created. 
I would like to know what type of input i need to take for case question in calling topic.