2022.2

Table Of Contents
AddKeySets
Inserts a new keyset inside GroupName and assigns values to keys as specified in KeyValues. Every
key specified in KeyValues must exist otherwise an error is raised. However, it is not required to spe-
cify all available keys in KeyValues. Only the keys specified are updated in GroupName while unspe-
cified keys are set to an empty string.
Syntax
AddKeySets(GroupName: string, KeyValues: JSONObjectArrayString): JSONIn-
tegerArray
Examples
Basic examples
In each of these examples, the object repoObject is deemed having been obtained through a call to
the COM object "RepositoryLib.WorkflowRepository" (see "Obtaining an instance of the Repository
Object" on page147).
JavaScript
repoObject.AddKeySets("Users", '[{"FirstName": "John","LastName": "Smith"},
{"FirstName": "Richard", "LastName": "Doe"}]');
VB Script
repoObject.AddKeySets "Users","
[{""FirstName"":""John"",""LastName"":""Smith""},
{""FirstName"":""Richard"",""LastName"": ""Doe""}]"
Inserting a row
In most cases, you won't need to insert or update a row in a script, as this can be easily done through
the the Push to Repository action task. However, in some cases you might want to script it for sim-
plicity's sake.
This JavaScript example inserts 2 different rows into the Users group.
var repoObject = new ActiveXObject("RepositoryLib.WorkflowRepository");
repoObject.AddKeySets("customers", '[{"CustomerID": "CUJS123456",
"FirstName": "John","LastName": "Smith"},
{"CustomerID": "CURD654321", "FirstName": "Richard", "LastName": "Doe"}]');
Tip: to update a row instead of adding it, use the GetValue() function to get the KeySet ID; then update
each individual value using SetValueByID() (see "GetValue" on page154 and "SetValueByID" on
page161).
Page 151