Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to use includes() function through scoped application

Divya95
Tera Contributor

Hi ,

We have written the below script getting error .Please suggest how to avoid this error .

Service Charac is of Name-value Data type .

 

var properties = Object.getOwnPropertyNames(rel.service_charac);
for (var name in parsed.service_charac)
{
if (!properties.includes(name))
{
rel.service_charac[name] = parsed.service_charac[name];
}

 

Error: "error": {
"message": "Cannot find function includes in object .",
"detail": "TypeError: Cannot find function includes in object . "

1 ACCEPTED SOLUTION

SanjivMeher
Mega Patron
Mega Patron

I am not sure, what is include. But you can use indexOf instead

 

if (properties.indexOf(name)==-1)


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

SanjivMeher
Mega Patron
Mega Patron

I am not sure, what is include. But you can use indexOf instead

 

if (properties.indexOf(name)==-1)


Please mark this response as correct or helpful if it assisted you with your question.

Thanks Sanjiv.Its working

Abhinay Erra
Giga Sage

What is your use case here?