{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":905,"path":"api-reference/server-api-reference/SPWidgetAccessControlGlobalAPI.md","title":"SPWidgetAccessControl - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# SPWidgetAccessControl- Global\n\nThe 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.\n\nFor details and instructions about using the SPWidgetAccessControl API in your server script, see [Configure widget security](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/configure-widget-security.md) \\(Restrict which tables public widgets can access for guest users\\).\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## SPWidgetAccessControl – SPWidgetAccessControl\\(\\)\n\nInstantiates the SPWidgetAccessControl object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| ||\n\nThe following example shows how to initialize a new SPWidgetAccessControl object.\n\n```\nnew global.SPWidgetAccessControl()\n```\n\n## SPWidgetAccessControl – hasPublicAccess\\(String tableName, Object SPScriptable, String options, Object input\\)\n\nReturns information about whether a specified table has public access to a widget.\n\n<table id=\"table_yjp_zpz_31b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ntableName\n\n</td><td>\n\nString\n\n</td><td>\n\nRequired. Name of the table to query. For example, enter `incident` to query the Incident \\[Incident\\] table.\n\n</td></tr><tr><td>\n\nSPScriptable\n\n</td><td>\n\nScriptable Object\n\n</td><td>\n\nRequired. Widget's SP Scriptable. Formatted as `$sp` in the request.```\nSPScriptable:{\n\"widgetSysId\":widget sys_id,\n\"request\":request object\n}\n```\n\n</td></tr><tr><td>\n\noptions\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Widget/rectangle options passed in the widget.```\n\"options\":{\n\"table\":\"incident\", \"maximum_entries\": \"10\"\n}\n\n```\n\n</td></tr><tr><td>\n\ninput\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Widget/rectangle input passed during runtime.```\n\"input\":{\n\"table\":\"incident\", \n\"display_field\":\"name\"\n}\n```\n\n</td></tr></tbody>\n</table><table id=\"table_zjp_zpz_31b\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates the widget access status of the specified table. Possible values:-   true: The provided table is granted security access on the widget.\n-   false: The provided table is not granted security access on the widget.\n\nDefault: false\n\n</td></tr></tbody>\n</table>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.\n\n```\noptions.table = \"incident\";\n//$sp,options,input - which are available by default in any widget script\nnew global.SPWidgetAccessControl().hasPublicAccess(options.table, $sp, options, input);\n```\n\nOutput:\n\n```\ntrue\n```\n\n"}}