The CreatorCon Call for Content is officially open! Get started here.

ConversionError: The undefined value has no properties.

Vijay27
Tera Guru

I got this error whenever i click on the ui action button 

***************ui action********** not client callable

(function(){
try {

var states = {InProgress: 18};
new sn_hr_core.ACNHRKnowledgeScoped().createDraftArticles(current);
current.setValue("state", states.InProgress);
current.update();
} catch (e) {
gs.addErrorMessage(e);
} finally {
action.setRedirectURL(current);
}
}());

 

*********script include********** not client callable

//Create draft knowlegde articles for each Primary and Additional language of pCaseGR.
createDraftArticles: function(pCaseGR) {
gs.debug("Debatri"+ pCaseGR);
var grLanguage;
var grKA;
var primary_language_id = "";
var additional_languages_ids = "";
var languages = "";
var language_choice_value = "";
var languages_ids;
var parent;

if (gs.nil(pCaseGR)) {
gs.debug('**final test1');
throw new Error("[" + this.type + "] - [createDraftArticles] - The pCaseGR parameter is not a valid GlideRecord");
}

primary_language_id = pCaseGR.variables.primary_language.toString();
languages = primary_language_id;

if (!gs.nil(pCaseGR.variables.additional_languages)) {
gs.debug('**final test2');
additional_languages_ids = pCaseGR.variables.additional_languages.toString().trim();
languages += "," + additional_languages_ids;
}

languages_ids = languages.split(",");

languages_ids.forEach(function(item, index) {
grLanguage = new GlideRecord(TABLES.Language);
grLanguage.addQuery("sys_id", item);
grLanguage.addQuery("id", "!=", "");
grLanguage.query();
if (grLanguage.next()) {
language_choice_value = grLanguage.getValue("id");
grKA = new GlideRecord(TABLES.KB);
grKA.newRecord();
grKA.setValue('kb_knowledge_base',gs.getProperty('sn_hr_core.acn.global.kb'));
grKA.setValue("short_description", pCaseGR.variables.article_title.toString());
grKA.setValue("text", pCaseGR.variables.article_content);
grKA.setValue("meta", pCaseGR.variables.meta.toString());
grKA.setValue("source", pCaseGR.getUniqueValue());
grKA.setValue("u_region", pCaseGR.variables.region.toString());
grKA.setValue("u_process_area", pCaseGR.variables.process_area.toString());
grKA.setValue("language", language_choice_value);
if (index == 0) {
// Primary Language and Parent KA
grKA.insert();
parent = grKA.getUniqueValue();
} else {
grKA.setValue("parent", parent);
grKA.insert();
}
}
});
},

 

4 REPLIES 4

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

have a look at the thread discussion below, it might help you for find the root cause of this error:

https://community.servicenow.com/community?id=community_question&sys_id=24008feddb58dbc01dcaf3231f96...

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

In tha above link the provided solution for client callable but my case is completely server side.

Thank you please help

Meenal Gharat
Tera Guru

Hi Vijay ,

Did you find any root cause on this error. in my case it is showing script include which is being called in business rule.

Thanks and Regards,

Meenal

shubham73
Kilo Contributor

Hi Vijay,

 

I am facing same error when calling script include from UI action (not client callable). did you overcome this error?

 

Thanks and Regards,

 Shubham