---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# SPWidgetAccessControl - Global

# SPWidgetAccessControl - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The SPWidgetAccessControl script include provides methods that allow administrators to check whether a provided table is granted public access to a widget and is securely accessed by an intended
audience.

For details and instructions about using the SPWidgetAccessControl API in your server script, see [Configure widget security](https://www.servicenow.com/docs/access?context=configure-widget-security&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US) (Restrict which tables public widgets can access for guest users).

## SPWidgetAccessControl -- SPWidgetAccessControl() {#ariaid-title2}

Instantiates the SPWidgetAccessControl object.
{#SPWAcsCtrl-SPWidgetAccessControl__table_mmg_lhl_b1c__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#SPWAcsCtrl-SPWidgetAccessControl__table_mmg_lhl_b1c}  
The following example shows how to initialize a new SPWidgetAccessControl object.

    new global.SPWidgetAccessControl()

## SPWidgetAccessControl -- hasPublicAccess(String tableName, Object SPScriptable, String options, Object input) {#ariaid-title3}

Returns information about whether a specified table has public access to a widget.
{#SPWAcsCtrl-hasPublicAccess_S_O_S_O__table_yjp_zpz_31b__entry__3}

| Name | Type | Description |
|-|-|-|
| tableName | String | Required. Name of the table to query. For example, enter `incident` to query the Incident \[Incident\] table. |
| SPScriptable | Scriptable Object | Required. Widget's SP Scriptable. Formatted as `$sp` in the request. SPScriptable:{ "widgetSysId":widget sys_id, "request":request object } |
| options | Object | Optional. Widget/rectangle options passed in the widget. "options":{ "table":"incident", "maximum_entries": "10" } |
| input | Object | Optional. Widget/rectangle input passed during runtime. "input":{ "table":"incident", "display_field":"name" } |
[Table 2. Parameters]

{#SPWAcsCtrl-hasPublicAccess_S_O_S_O__table_yjp_zpz_31b} {#SPWAcsCtrl-hasPublicAccess_S_O_S_O__table_zjp_zpz_31b__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates the widget access status of the specified table. Possible values: * true: The provided table is granted security access on the widget. * false: The provided table is not granted security access on the widget. {#SPWAcsCtrl-hasPublicAccess_S_O_S_O__ul_ptt_5ll_b1c} Default: false |
[Table 3. Returns]

{#SPWAcsCtrl-hasPublicAccess_S_O_S_O__table_zjp_zpz_31b}  
The following example shows confirmation that the Incident table has access to the Simple List Widget as shown in the configuration table, m2m_sp_public_widget_allow_table.

    options.table = "incident";
    //$sp,options,input - which are available by default in any widget script
    new global.SPWidgetAccessControl().hasPublicAccess(options.table, $sp, options, input);

Output:

    true


