User Manual

05.16.2025

MANUAL

Developer Function: Server Script: model

## Overview This object holds information on the current "Record" available for use in the "[Server Script](/en/manual/table-management-server-script)". You can read the values ​​of "[Column](/en/manual/table-management-column)" using the properties. Assigning values to properties can change the display of column in the "[Screen Index](/en/manual/table-grid)" or "[Editor](/en/manual/table-management-editor)", but you cannot update "Record". To get "Record" from other tables or to update "records", use the "「items Object」". ## Limitations 1. Cannot be used with the conditions "When Loading Site Settings" or "When Processing View". 1. Can only be used with the "[Screen Index](/en/manual/table-grid)" condition "Before Row Display". 1. Cannot get "[Column](/en/manual/table-management-column)" that do not have "Read Permission" in "「Column Access Control」". 1. Cannot change the display of "[Column](/en/manual/table-management-column)" that do not have "update permissions" in "「Column Access Control」" even if you assign a value. 1. Cannot get "[Column](/en/manual/table-management-column)" that does not exist on the screen. Use "AlwaysGetColumns Object" to get "[Column](/en/manual/table-management-column)" that is not on the screen. 1. Cannot get the file with "「Attachment Column」". Can only get metadata (JSON) related to the attachment. ## Properties |No|Property Name|Get|Set|Type|Description| |:----|:----|:----|:----|:----|:----| |1|IssueId / ResultId|Yes|No |long|"「ID Column」"| |2|SiteId|Yes|No |long|"Site ID Column"| |3|Creator|Yes|No|int|"[Creator Column](/en/manual/table-management-creator)"| |4|CreatedTime|Yes|No|DateTime|"「Created Datetime Column」"| |5|Updator|Yes|No|int|"[Updater Column](/en/manual/table-management-updator)"| |6|UpdatedTime|Yes|No|DateTime|"[Update Datetime Column](/en/manual/table-management-updated-time)"| |7|Ver|Yes|No|int|"「Version Column」"| |8|Title|Yes|Yes|string|"「Title Column」"| |9|Body|Yes|Yes|string|"「Body Column」"| |10|StartTime|Yes|Yes|DateTime|"[Start Column](/en/manual/table-management-start-time)"| |11|CompletionTime|Yes|Yes|DateTime|"「Complete Column」"| |12|WorkValue|Yes|Yes|decimal|"「Work Volume Column」"| |13|ProgressRate|Yes|Yes|decimal|"[Progression Rate Column](/en/manual/table-management-progress-rate)"| |14|RemainingWorkValue|Yes|No|decimal|"[Remaining Work Volume Column](/en/manual/table-management-remaining-work-value)"| |15|Status|Yes|Yes|int|"[Status Column](/en/manual/table-management-status)"| |16|Manager|Yes|Yes|int|"[Manager Column](/en/manual/table-management-manager)"| |17|Owner|Yes|Yes|int|"[Owner Column](/en/manual/table-management-owner)"| |18|Locked|Yes|Yes|bool|"「Lock Column」"| |19|Comments|Yes|No|string|"「Comment Column」"| |20|ClassA to Z|Yes|Yes|string|"[Class Column](/en/manual/table-management-class)"| |21|NumA to Z|Yes|Yes|decimal|"[Numeric Value Column](/en/manual/table-management-num)"| |22|DateA to Z|Yes|Yes|DateTime|"「Date Column」"| |23|DescriptionA to Z|Yes|Yes|string|"「Description Column」"| |24|CheckA to Z|Yes|Yes|bool|"「Check Column」"| |25|AttachmentsA to Z|Yes|No|string|"「Attachment Column」"| |26|ExtendedRowCss|Yes|Yes|string|Row CSS| |27|ExtendedRowData|Yes|Yes|string|Row data attribute| |28|UpdateOnExit|No|Yes|bool|Update record after server script ends| |29|ReadOnly|Yes|Yes|bool|Record is read-only| ## Method There are no methods. ## Usage Example 1 The following example retrieves the "[Update Datetime Column](/en/manual/table-management-updated-time)". As the time is obtained in UTC, convert it to JST as needed. ##### JavaScript ``` let updatedTime = model.UpdatedTime; ``` ## Usage Example 2 The following example retrieves the "[Status Column](/en/manual/table-management-status)". The value, not the name displayed, is retrieved. ##### JavaScript ``` let status = model.Status; ``` ## Usage Example 3 The following example sets the "「Title Column」" to 'New record title'. ##### JavaScript ``` model.Title = 'New Record Title'; ``` ## Usage Example 4 The following example sets the "[Status Column](/en/manual/table-management-status)" to 300 (Review). The value, not the name displayed, is assigned. ##### JavaScript ``` model.Status = 300; ``` ## Usage Example 5 The following example sets the "[Class Column](/en/manual/table-management-class)" to "Tokyo". ##### JavaScript ``` model.ClassB = 'Tokyo'; ``` ## Usage Example 6 The following example retrieves the value of a "[Class Column](/en/manual/table-management-class)" with "[Multiple Selection](/en/manual/table-management-multiple-selections)" turned on. The retrieved value needs to be processed by replacing it into an array as follows. *The option list has [[Groups*]] set. ##### JavaScript ``` let groupIdList = JSON.parse(model.ClassA); for (let groupId of groupIdList) { context.Log(groupId); } ``` ## Usage Example 7 The following example assigns "Design" and "Construction" to a "[Class Column](/en/manual/table-management-class)" with "[Multiple Selection](/en/manual/table-management-multiple-selections)" turned on. Assign JSON-formatted strings for "[Class Column](/en/manual/table-management-class)" with "[Multiple Selection](/en/manual/table-management-multiple-selections)" turned on. ##### JavaScript ``` let data = []; data.push('Design'); data.push('Construction'); model.ClassA = JSON.stringify(data); ``` ## Usage Example 8 The following example sets yellow background CSS for records where the "[Manager Column](/en/manual/table-management-manager)" or "[Owner Column](/en/manual/table-management-owner)" is the logged-in user in the "[Screen Index](/en/manual/table-grid)". The condition "Before Row Display" is used. Combine "[Server Script](/en/manual/table-management-server-script)" and "[Style](/en/manual/table-management-style)". ##### JavaScript ``` if (model.Manager === context.UserId || model.Owner === context.UserId) { model.ExtendedRowCss = 'own'; } ``` ##### CSS ``` .own { background-color: yellow; } ``` ## Usage Example 9 The following example adds the data attribute "data-extension" to records in the "[Screen Index](/en/manual/table-grid)". *The attribute name is fixed as "extension". To add multiple data attributes, store them in a JSON object and set them. ##### JavaScript ``` model.ExtendedRowData = JSON.stringify({ timeout: limit }); ``` Generated HTML: ##### HTML ``` <tr class="grid-row" data-extension="'{"timeout":300}'"> ... ``` Reference it in a script using jQuery's data(). ##### JavaScript ``` const handler = function () { $('table tr').each(function (i, e) { var ext = $(e).data('extension'); // var ext is a JSON object if (Date.now() > ext.timeout) { ... } }); }; ``` ## Usage Example 10 The following example sets today's date in the "「Date Column」" and updates the record after the server script ends. ##### JavaScript ``` model.DateA = utilities.Today(); model.UpdateOnExit = true; ``` ## Example Output Output example of model.AttachmentsA (formatted from the output string): ``` [ { "Guid": "18F34BCD594F4FF6A94D7C0F9C8AB5D4", "Name": "test.txt", "Size": 4, "HashCode": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=" } ] ``` Output example of model.Comments (formatted from the output string): ``` [ { "CommentId": 1, "CreatedTime": "2022-12-22T14:42:56.7963585+09:00", "Creator": 1, "Body": "The text of your comment goes here" } ] ``` ## Detailed Information 1. On the "[Screen Index](/en/manual/table-grid)", this can only be used if the condition is set to "Before Row Display". The "[Server Script](/en/manual/table-management-server-script)" is executed for each row, and the records of each row are stored in the "model object". 1. In the "[Editor](/en/manual/table-management-editor)", the information of the "record" currently displayed on the screen is stored in the "model object". ## Supported versions |Supported versions|Contents| |:--|:--| |1.3.27.0 and later|Added Comments<br>Added Attachments| ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-grid">Table Function: Record Screen Index</a><span>10.02.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-column">Manage Table: Column</a><span>10.07.2024 up</span></li> <li><a href="/en/manual/table-management-start-time">Manage Table: Column: Start</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-progress-rate">Manage Table: Column: Progression Rate</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-remaining-work-value">Manage Table: Column: Remaining Work Volume</a><span>10.11.2024 up</span></li> <li><a href="/en/manual/table-management-status">Manage Table: Column: Status</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-manager">Manage Table: Column: Manager</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-owner">Manage Table: Column: Owner</a><span>10.11.2024 up</span></li> <li><a href="/en/manual/table-management-class">Table Management: Item: Classification</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-num">Manage Table: Column: Numerical Value</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-creator">Manage Table: Column: Creator</a><span>10.11.2024 up</span></li> <li><a href="/en/manual/table-management-updator">Manage Table: Column: Updater</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-updated-time">Manage Table: Column: Update Datetime</a><span>10.11.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-editor">Table Management: Editor</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-multiple-selections">Manage Table: Editor: Column Advanced Settings: Multiple Selection</a><span>10.02.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-style">Table Management: Style</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.