...
Tip |
---|
Role required: admin. |
...
...
...
...
...
...
...
...
Recommendations
To speed up the sampling generation, it is recommended to use the selectAttributes() method of the SimpleRecord class.
The example below generates an array containing IDs of the records:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const user = new SimpleRecord('user');
user.addQuery('email', 'like', 'best.company');
user.selectAttributes('sys_id'); // select sys_id only
user.query();
const userIDs = [];
while (user.next()) {
userIDs.push(user.sys_id);
}
|
Comment your code when you use the Choice attributes in your scripts:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
if (current.stage == '4' || current.stage == '6') { // Canceled OR Completed
const start = new SimpleDateTime(current.start_time);
//...
|
Use the getAttributes() method to check an object before inserting or updating:
...
language | js |
---|---|
theme | Eclipse |
linenumbers | true |
...
...
Also, this method allows checking whether an object has a specified attribute or not before calling:
...
language | js |
---|---|
theme | Eclipse |
linenumbers | true |
...