Query against table incident restricted by domain values

reeba1
Tera Contributor

Hello,

I am getting this error message "Query against table incident   and table service_offering restricted by domain values" when I run a background script to autoclose an incident. Why does this happen? How to resolve this?

This is the background script I have written.

 

checkdeliveredtask('incident','state=5',1,'xy');

function checkdeliveredtask(table,query,days,domaine){

var pn=0;

var dmn=new GlideRecord('service_offering');

dmn.addQuery('GOTOsys_domain.nameLIKE'+domaine.name);

dmn.queryNoDomain();

dmn.setLimit(1);

dmn.query();

while(dmn.next()){

var dt= new GlideRecord(table);

//dt.addDomainQuery(dmn);

dt.addQuery(query);

dt.addQuery('sys_domain.name='+domaine.name);

//dt.addQuery('active=true^ORactive=false');

dt.query();

                                                              gs.print("incident number:"+number);

while(dt.next())

{

var d=dt.u_delivered;

var day =new GlideDateTime(d);

switch(day.getDayOfWeek())

{

case 5://5

pn= parseInt(days)+2;

break;

case 4:

pn=parseInt(days)+2;

break;

default:

pn=parseInt(days);

}

//Counting days from day ticket is delivered

if(dt.u_delivered < gs.minutesAgo(pn))

{

dt.state = 3;

                                                                                              gs.print("status is:"+state);

dt.update();

            }

}

}

Regards,

Reeba

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Does your user account have access to the records in that domain?


Hi Brad,


Yes my account has access to the records in that domain. I tried this global domain also, there also I got the same message.


Hi Reeba,



Can you please post the solution here if you get any