-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathAgentSetupBuffer.Table.al
More file actions
220 lines (205 loc) · 8.39 KB
/
AgentSetupBuffer.Table.al
File metadata and controls
220 lines (205 loc) · 8.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Agents;
using System.Environment.Configuration;
/// <summary>
/// Setup record used to configure the agents. It should be used together with <see cref="Agent Setup"/> codeunit and <see cref="Agent Setup Part"/> page.
/// </summary>
table 4310 "Agent Setup Buffer"
{
Caption = 'Agent Setup Buffer';
TableType = Temporary;
ReplicateData = false;
DataClassification = SystemMetadata;
InherentEntitlements = X;
InherentPermissions = X;
fields
{
/// <summary>
/// The unique security identifier for the user account associated with this agent.
/// </summary>
field(1; "User Security ID"; Guid)
{
Caption = 'User Security ID';
Tooltip = 'Specifies the unique identifier for the agent user.';
}
/// <summary>
/// The provider that supplies metadata and configuration information for this agent.
/// </summary>
field(2; "Agent Metadata Provider"; Enum "Agent Metadata Provider")
{
Caption = 'Agent Metadata Provider';
Tooltip = 'Specifies the provider for the agent metadata.';
}
/// <summary>
/// The user name of the account associated with this agent.
/// </summary>
field(3; "User Name"; Code[50])
{
Caption = 'User Name';
Tooltip = 'Specifies the name of the user that is associated with the agent.';
trigger OnValidate()
begin
Rec."Values Updated" := true;
end;
}
/// <summary>
/// The display name shown for this agent in the user interface.
/// </summary>
field(4; "Display Name"; Text[80])
{
Caption = 'Display Name';
Tooltip = 'Specifies the display name of the user that is associated with the agent.';
trigger OnValidate()
begin
Rec."Values Updated" := true;
end;
}
/// <summary>
/// The current operational state of the agent (Enabled or Disabled).
/// </summary>
field(5; "State"; Option)
{
Caption = 'State';
OptionCaption = 'Active,Inactive';
OptionMembers = Enabled,Disabled;
Tooltip = 'Specifies the state of the user that is associated with the agent.';
InitValue = Disabled;
trigger OnValidate()
begin
SetStateUpdated();
end;
}
/// <summary>
/// The initials displayed on the agent's icon in the timeline and user interface.
/// </summary>
field(15; Initials; Text[4])
{
Caption = 'Initials';
ToolTip = 'Specifies the initials to be displayed on the icon opening the agent''s timeline.';
}
/// <summary>
/// Short summary of the agents capabilities and role.
/// </summary>
field(5000; "Agent Summary"; Blob)
{
Caption = 'Agent Summary';
ToolTip = 'Specifies a short summary of the agents capabilities and role. Value is changed through code.';
}
/// <summary>
/// Specifies the language that is used for task details and outgoing messages unless language is changed by the code
/// </summary>
field(5001; "Language Used"; Text[1024])
{
Caption = 'Language Used';
ToolTip = 'Specifies the language that is used for task details and outgoing messages unless language is changed by the code. Value is changed through code.';
Editable = false;
AllowInCustomizations = Never;
}
/// <summary>
/// Specifies whether the values are updated. Example of the fields that are tracked are - user name, user display name, initials. Value is changed through code.
/// </summary>
field(5002; "Values Updated"; Boolean)
{
Caption = 'Config Updated';
ToolTip = 'Specifies whether the configuration has been updated. Value is changed through code.';
Editable = false;
AllowInCustomizations = Never;
}
/// <summary>
/// Specifies whether the access control to the agent is updated. This means that the settings on who can access the agent were changed.
/// </summary>
field(5003; "Access Updated"; Boolean)
{
Caption = 'Access Updated';
ToolTip = 'Specifies whether the access control has been updated. Value is changed through code.';
Editable = false;
AllowInCustomizations = Never;
}
/// <summary>
/// Specifies whether the user settings (language, regional settings, time zone) have been updated.
/// </summary>
field(5004; "User Settings Updated"; Boolean)
{
Caption = 'User Settings Updated';
ToolTip = 'Specifies whether the user settings (language, regional settings, time zone) have been updated. Value is changed through code.';
Editable = false;
AllowInCustomizations = Never;
}
/// <summary>
/// Specifies whether the state (Active or Inactive) was updated.
/// </summary>
field(5005; "State Updated"; Boolean)
{
Caption = 'State Updated';
ToolTip = 'Specifies whether the state has been updated. Value is changed through code.';
Editable = false;
AllowInCustomizations = Never;
}
/// <summary>
/// Specifies the last user who configured the agent.
/// </summary>
field(5020; "Configured By"; Guid)
{
Caption = 'Configured By';
ToolTip = 'Specifies the last user who configured the agent.';
Editable = false;
}
}
keys
{
key(PK; "User Security ID")
{
Clustered = true;
}
}
internal procedure SetTempAgentAccessControl(var NewTempAgentAccessControl: Record "Agent Access Control" temporary)
begin
TempAgentAccessControl.Reset();
TempAgentAccessControl.DeleteAll();
CopyTempAgentAccessControl(NewTempAgentAccessControl, TempAgentAccessControl);
end;
internal procedure GetTempAgentAccessControl(var TempCopiedTempAccessControl: Record "Agent Access Control" temporary)
begin
CopyTempAgentAccessControl(TempAgentAccessControl, TempCopiedTempAccessControl);
TempCopiedTempAccessControl.Reset();
end;
internal procedure CopyTempAgentAccessControl(var SourceTempAgentAccessControl: Record "Agent Access Control" temporary; var TargetTempAgentAccessControl: Record "Agent Access Control" temporary)
begin
TargetTempAgentAccessControl.Reset();
TargetTempAgentAccessControl.DeleteAll();
if not SourceTempAgentAccessControl.FindSet() then
exit;
repeat
TargetTempAgentAccessControl.TransferFields(SourceTempAgentAccessControl, true);
TargetTempAgentAccessControl.Insert()
until SourceTempAgentAccessControl.Next() = 0;
end;
internal procedure GetUserSettings(var TempNewUserSetting: Record "User Settings" temporary)
var
TempFetchedUserSettings: Record "User Settings" temporary;
Agent: Codeunit Agent;
begin
if not TempUserSettings.FindFirst() then begin
Agent.GetUserSettings(Rec."User Security ID", TempFetchedUserSettings);
TempFetchedUserSettings.Copy(TempUserSettings);
end;
TempNewUserSetting.Copy(TempUserSettings, true);
end;
internal procedure SetUserSettings(var UserSettingsRec: Record "User Settings")
begin
TempUserSettings.Reset();
TempUserSettings.DeleteAll();
TempUserSettings.Copy(UserSettingsRec);
TempUserSettings.Insert();
end;
local procedure SetStateUpdated()
begin
Rec."State Updated" := true;
end;
var
TempAgentAccessControl: Record "Agent Access Control" temporary;
TempUserSettings: Record "User Settings" temporary;
}