Create-Only ACL?

zschneider
Kilo Expert

I'm currently building a custom angular app inside a UI Page in a Service-Now instance that will be used for non-licensed users. I want to have a metrics table that collects data from the app via a REST call.

The challenge I have is I want to restrict read access to the table to only admins, but I want anyone (even users without a license) to be able to create a record.

But it looks like the read condition on an ACL needs to be set to true before a user can write to that field even if they have create/write access. I've tried creating a custom ACL condition that checks to see if isValidRecord() is true or if the necessary fields are empty to give read access. This seems to work inside Service-Now but still fails on a rest call. So what happens is REST call creates an empty record and ignores the data for the fields.

Any suggestions on how I can create an ACL condition that allows a user to submit to the table via REST but restricts viewing submitted records on the table?

1 ACCEPTED SOLUTION

Thijs Daemen
Mega Guru

Hi Zach,



I don't think you can insert into a table without a read record. Maybe you could create an ACL with some script using current.isNewRecord(). I haven't tried it though, so I'm not sure it will work for you.



http://wiki.servicenow.com/index.php?title=GlideRecord#isNewRecord&gsc.tab=0



I have a question myself, how are you dealing with the rest api for users without a role. Since the rest api requires a role to be used. Aren't users with a role considered a licensed user? I'm assuming you're doing the rest calls from the context of the logged in user.


View solution in original post

5 REPLIES 5

kavishree_snow
Kilo Explorer

Hi, 

I created ACL role for create/write/read/delete to the table. But still I am not able to write a record into the table by specific user logged in. I used following code to insert the record.

var grInsert = new GlideReorcSecure(<table_name>);

grInsert .initialize();

grInsert .name = 'sample';

grInsert .id = 123;

grInsert .insert()

 

When I printed the inserting value, it was showing empty values for all the fields. Can anyone please suggest me the solution.

 

Regards,

Kavishree S