User Manual

12.27.2024

MANUAL

Developer Function: Server Script: context

## Overview The "[Server Script](/en/manual/table-management-server-script)" is used to reference user request information such as user IDs and site IDs. It is also used for data sharing between scripts, logging, and message output. ## Properties |No|Name|Get|Set|Type|Description| |:----|:----|:----|:----|:----|:----| |1|[UserData](/manual/server-script-context-user-data)|Yes|Yes|ExpandoObject|Allow data sharing between scripts| |2|[QueryStrings](/manual/server-script-context-query-strings)|Yes|No|Object|Get the value of URL query parameters| |3|[Forms](/manual/server-script-context-forms)|Yes|No|Forms|Get form information| |4|FormStringRaw|Yes|No|string|Information entered in the form (column)| |5|FormString|Yes|No|string|Information entered in the form (column)| |6|Ajax|Yes|No|bool|Flag indicating whether the request was made via Ajax| |7|Mobile|Yes|No|bool|Flag indicating whether the request was made via Mobile| |8|ApplicationPath|Yes|No|string|Application path| |9|AbsoluteUri|Yes|No|string|Absolute URI| |10|AbsolutePath|Yes|No|string|Absolute path| |11|Url|Yes|No|string|URL| |12|UrlReferrer|Yes|No|string|Previously requested URL| |13|Controller|Yes|No|string|Controller name| |14|Query|Yes|No|string| URL query parameters| |15|Action|Yes|No|string|Action name| |16|TenantId|Yes|No|int|Tenant ID| |17|SiteId|Yes|No|long|Site ID| |18|Id|Yes|No|long|Record ID| |19|Groups|Yes|No|IEnumerable<int>|Collection of group IDs of groups to which the user belongs| |20|TenantTitle|Yes|No|string|Tenant title| |21|SiteTitle|Yes|No|string|Site title| |22|RecordTitle|Yes|No|string|Record title| |23|DeptId|Yes|No|int|Department ID| |24|UserId|Yes|No|int|User ID| |25|LoginId|Yes|No|string|Log ID| |26|Language|Yes|No|string|Setting language| |27|TimeZoneInfo|Yes|No|string|Time zone| |28|HasPrivilege|Yes|No|bool|Flag indicating whether the operating user is a privileged user| |29|ApiVersion|Yes|No|decimal|API version| |30|ApiRequestBody|Yes|No|string|API request content| |31|RequestDataString|Yes|No|string|Request data| |32|ContentType|Yes|No|string|Response header type| |33|ControlId|Yes|No|string|Request source control ID| |34|Condition|Yes|No|string|Name of server script condition| ## Methods |No|Name|Description| |:----|:----|:----| |1|[AddMessage](/manual/server-script-context-add-message)|Output a message at the bottom of the browser screen. | |2|[Error](/manual/server-script-context-error)|Cancel the user's create, update, or delete operation and outputs an error message. | |3|[Log](/manual/server-script-context-log)|Output a log to the browser console. | |4|[Redirect](/manual/server-script-context-redirect)|Cause the browser to transition to a new page. | |5|[AddResponse](/manual/server-script-context-add-response)|Return an arbitrary client response. | |6|[ResponseSet](/manual/server-script-context-response-set)|Store information in a form. | ## Usage Example 1 In the example below, if the user ID of the logged-in user is not 1, the filter will display only records whose creator is own. The condition is checked "When Processing Views." ##### JavaScript ``` if (context.UserId !== 1) { view.Filters.Creator = context.UserId; } ``` ## Usage Example 2 The following example outputs to the log the group IDs of all groups to which the logged-in user belongs. ##### JavaScript ``` for (let groupId of context.Groups){ context.Log(groupId); } ``` ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/server-script-context-add-message">Developer Function: Server Script: context.AddMessage</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-context-add-response">Developer Function: Server Script: context.AddResponse</a><span>08.14.2024 up</span></li> <li><a href="/en/manual/server-script-context-error">Developer Function: Server Script: context.Error</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-context-forms">Developer Function: Server Script: context.Forms</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-context-query-strings">Developer Function: Server Script: context.QueryStrings</a><span>08.14.2024 up</span></li> <li><a href="/en/manual/server-script-context-redirect">Developer Function: Server Script: context.Redirect</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-context-response-set">Developer Function: Server Script: context.ResponseSet</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-context-user-data">Developer Function: Server Script: context.UserData</a><span>08.14.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.