Cannot insert a record in a custom table using while the record can be inserted in the parent table

B_22
Kilo Contributor

Hello,

I created code that inserts a new record in a custom class. This class is a child class of cmdb_ci. The code looks like this:

        new_si_support_record = new GlideRecord('support_ci');
        new_si_support_record.newRecord();
        new_si_support_record.po_number = "po number";
        new_si_support_record.model_id = cmdb_model_sys_id;
        new_si_support_record.operational_status = 1;
        new_si_support_record.name = "some name";
        new_si_support_record_sys_id = new_si_support_record.insert();

 

This does not work. When I change the first line to:

        new_si_support_record = new GlideRecord('cmdb_ci');

it does work.

The support_ci table is created in its own application/scope. So I checked the settings for application access on the table and enabled everything to be sure.

find_real_file.png

But still, I was unable to create a new record in the 'support_ci' table.

Because I am able to insert records into the cmdb_ci table, I assume the code is correct and the 'cross scope privileges' are sufficient.

What could be wrong?

20 REPLIES 20

I agree

Only, I did not find a way to give more information, until this hint. The problem was that I executed the code as part of an email action. But now I remember the background script execution module.

When I execute the code I do get an error:

Security restricted: 


Create operation against 'x_spit_devops_si_o_si_support' from scope 'rhino.global'
has been refused due to the table's cross-scope access policy



Now, I need to find out how to fix this...

You need to create below cross scope access record:

find_real_file.png

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Have you tried this?

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

So it's a scope issue as described in the following page.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0727180

Just wondering if the script is created in the same scope as the u_support table.

no, it is not.