Records Actions
Add record field (with no values) if it doesn't already exist.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
Example
myRecord = createRecord() addRecordField(myRecord, "sn")
Add record field value.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
value* | text, expression, variable | the value to add to the field |
ignoreCase | boolean, expression, variable | ignore the case of the value when deciding if a duplicate (default: false) |
Example
myRecord = createRecord() addRecordField(myRecord, "registeredCourses") addRecordFieldValue(myRecord, "registeredCourses", "English I") addRecordFieldValue(myRecord, "registeredCourses", "Algebra I") addRecordFieldValue(myRecord, "registeredCourses", "Band")
Add record field values.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
values* | text, expression, variable | An array containing the values to add to the field |
ignoreCase | boolean, expression, variable | ignore the case of the value when deciding if a duplicate (default: false) |
Example
myRecord = createRecord() addRecordField(myRecord, "registeredCourses") addRecordFieldValue(myRecord, "registeredCourses", "English I") addRecordFieldValue(myRecord, "registeredCourses", "Algebra I") addRecordFieldValue(myRecord, "registeredCourses", "Band") addRecordFieldValues(myRecord, "registeredCourses", ["Physical Science","Physical Ed"])
Clear record field values.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
Example
myRecord = createRecord() addRecordField(myRecord, "registeredCourses") addRecordFieldValue(myRecord, "registeredCourses", "English I") addRecordFieldValue(myRecord, "registeredCourses", "Algebra I") addRecordFieldValue(myRecord, "registeredCourses", "Band") clearRecordFieldValues(myRecord, "registeredCourses")
Make a duplicate copy of a record.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record to copy |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
myRecord = createRecord() addRecordField(myRecord, "registeredCourses") addRecordFieldValue(myRecord, "registeredCourses", "English I") addRecordFieldValue(myRecord, "registeredCourses", "Algebra I") addRecordFieldValue(myRecord, "registeredCourses", "Band") newRecord = copyRecord(myRecord)
Copy a record field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
oldField* | text, expression, variable | the field name of the original field. |
newField* | text, expression, variable | the field name of the new field. |
Example
myRecord = createRecord() addRecordField(myRecord, "groupMembership") addRecordFieldValue(myRecord, "groupMembership", "cn=AllStaff,ou=groups,o=data") addRecordFieldValue(myRecord, "groupMembership", "cn=AllTeachers,ou=groups,o=data") copyRecordField(myRecord,"groupMembership","securityEquals")
Copy fields from one record to another.
Property | Value | Description |
---|---|---|
srcRecord* | expression, variable | the source record |
destRecord* | expression, variable | the destination record |
fields | text, expression, variable | comma separated list of fields to copy (default: all fields) |
Example
myRecord = createRecord() addRecordField(myRecord, "groupMembership") addRecordFieldValue(myRecord, "groupMembership", "cn=AllStaff,ou=groups,o=data") addRecordFieldValue(myRecord, "groupMembership", "cn=AllTeachers,ou=groups,o=data") copyRecordField(myRecord,"groupMembership","securityEquals") newRecord = createRecord() copyRecordFields(myRecord,newRecord,["groupMembership","securityEquals"])
Create a new record object. A record is made of of fields, each of which may have 0 or more values.
Property | Value | Description |
---|---|---|
caseSensitiveNames | boolean, expression, variable | field names are case-insensitive (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
user = createRecord() setRecordFieldValue(user,"objectclass","inetOrgPerson")
Create a new record object from an ECMAScript object.
Property | Value | Description |
---|---|---|
seed | expression, variable | Seed object that provides the initial fields and values for the Record |
caseSensitiveNames | boolean, expression, variable | field names are case-insensitive (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
record = createRecordFromObject({sn: "John", givenName: "Doe"})
Create a new record object from an XML object using this
Property | Value | Description |
---|---|---|
xml | expression, variable | XML object that provides the initial fields and values for the Record |
excludeAttrs | boolean, expression, variable | exclude all XML attributes (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
xml = <data> <sn>John</sn> <givenName>Doe</givenName> </data> record = createRecordFromXML(xml)
Filter record fields.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
fields* | text, expression, variable | comma separated list (or an array) of fields to keep - all others will be removed. |
Example
user = createRecord() addRecordField(user,"objectclass") addRecordField(user,"sn") addRecordField(user,"givenName") addRecordField(user,"ssn") filterRecordFields(user,"objectclass,sn,givenName")
Get all record field names.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
fieldNames = getRecordFieldNames(record) forEach(fieldName, fieldNames) { log(fieldName + ": " + record.fieldName }
Get the first value of a record field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
user = createRecord() addRecordFieldValue(user,"objectclass","inetOrgPerson") addRecordFieldValue(user,"objectclass","Top") addRecordFieldValue(user,"objectclass","Person") objectClass = getRecordFieldValue(user,"objectclass")
Get all values of record field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
user = createRecord() addRecordFieldValue(user,"objectclass","inetOrgPerson") addRecordFieldValue(user,"objectclass","Top") addRecordFieldValue(user,"objectclass","Person") objectClasses = getRecordFieldValues(user,"objectclass")
Check if record has a field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
user = createRecord() addRecordFieldValue(user,"objectclass","inetOrgPerson") addRecordFieldValue(user,"objectclass","Top") addRecordFieldValue(user,"objectclass","Person") hasObjectClass = hasRecordField(user,"objectclass") hasGivenName = hasRecordField(user,"givenName") # Should return "We have class!" if(hasObjectClass) { log("We have class!") } else { } if(hasGivenName) { log("We have a name!") } else { }
Check if record field has a given value.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
value* | text, expression, variable | the value to check. |
ignoreCase | boolean, expression, variable | ignore the case of the value when comparing (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
student = createRecord() addRecordFieldValue(student ,"course","english") addRecordFieldValue(student ,"course","science") addRecordFieldValue(student ,"course","art") hasEnglish = hasRecordFieldValue(user,"course","english") hasMath = hasRecordFieldValue(user,"course","math") # Should return "Y,N" if(hasEnglish) { log("Y") } else { } if(hasMath) { log("N") } else { }
Compare two records for equality.
Property | Value | Description |
---|---|---|
record1* | expression, variable | the first record |
record2* | expression, variable | the second record |
fields | expression,text,variable | comma separated list of fields to compare (default: all fields) |
ignoreCase | boolean, expression, variable | ignore the case of the value when comparing (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
inputRecord = getNextTextInputRecord(input) existingRecord = getADRecord(sessionAD, inputRecord['@dn']) if(existingRecord) { same = recordEquals(inputRecord, existingRecord) if(!same) { saveADRecord(inputRecord) } } else { }
Remove record field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
Example
user = createRecord() addRecordField(user,"objectclass") addRecordField(user,"sn") addRecordField(user,"givenName") addRecordField(user,"ssn") removeRecordField(user,"ssn")
Remove record fields.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
fields* | text, expression, variable | comma separated list of fields to remove |
Example
user = createRecord() addRecordField(user,"objectclass") addRecordField(user,"sn") addRecordField(user,"givenName") addRecordField(user,"ssn") removeRecordField(user,"ssn,objectclass")
Remove record field value.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
value* | text, expression, variable | the value to remove from the field |
ignoreCase | boolean, expression, variable | ignore the case of the value when comparing (default: false) |
Example
student = createRecord() addRecordFieldValue(student ,"course","english") addRecordFieldValue(student ,"course","science") addRecordFieldValue(student ,"course","art") removeRecordFieldValue(user,"course","english")
Remove record field values.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
values* | text, expression, variable | An array containing the values to remove from the field |
ignoreCase | boolean, expression, variable | ignore the case of the value when comparing (default: false) |
Example
student = createRecord() addRecordFieldValue(student ,"course","english") addRecordFieldValue(student ,"course","science") addRecordFieldValue(student ,"course","art") removeRecordFieldValues(user,"course",["english","art"])
Rename a record field.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
oldField* | text, expression, variable | the original field name |
newField* | text, expression, variable | the new field name |
Example
user = createRecord() addRecordField(user,"objectclass") addRecordField(user,"sn") addRecordField(user,"givenName") addRecordField(user,"ssn") renameRecordField(user,"ssn","workforceID")
Rename fields within a record.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
oldFields* | text, expression, variable | comma separated list of the original field names |
newFields* | text, expression, variable | comma separated list of the new field names |
Example
user = createRecord() addRecordField(user,"objectclass") addRecordField(user,"Surname") addRecordField(user,"Given Name") addRecordField(user,"ssn") renameRecordFields(user,["Surname","Given Name","ssn"], ["sn","givenName","workforceID"])
Set record field to a value.
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
value* | text, expression, variable | the field value |
Example
user = createRecord() setRecordFieldValue(user,"objectclass","Top") setRecordFieldValue(user,"objectclass","inetOrgPerson")
Property | Value | Description |
---|---|---|
record* | expression, variable | the record |
field* | text, expression, variable | the field name |
values* | text, expression, variable | An array containing the values to set to the field |
Example
student = createRecord() setRecordFieldValues(student,"course",["english","math","science"])
<reports ns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss"> <entry> <id>tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637619.xml</id> <title>A large tree branch is blocking the road</title> <updated>2010-04-13T18:30:02-05:00</updated> <link rel="self" href="http://open311.sfgov.org/dev/V1/reports/637619.xml"/> <author><name>John Doe</name></author> <georss:point>40.7111 -73.9565</georss:point> <category label="Damaged tree" term="tree-damage" scheme="https://open311.sfgov.org/dev/V1/categories/006.xml">006</category> <content type="xml" ns="http://open311.org/spec/georeport-v1"> <report_id>637619</report_id> <address>1600 Market St, San Francisco, CA 94103</address> <description>A large tree branch is blocking the road</description> <status>created</status> <status_notes /> <policy>The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code</policy> </content> </entry> <entry> <id>tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637620.xml</id> <title>A large tree branch is blocking the road</title> <updated>2010-04-13T18:30:02-05:00</updated> <link rel="self" href="http://open311.sfgov.org/dev/V1/reports/637620.xml"/> <author><name>John Doe</name></author> <georss:point>40.7111 -73.9565</georss:point> <category label="Damaged tree" term="tree-damage" scheme="https://open311.sfgov.org/dev/V1/categories/006.xml">006</category> <content type="xml" ns="http://open311.org/spec/georeport-v1"> <report_id>637620</report_id> <address>56 Market St, San Francisco, CA 94103</address> <description>A large tree branch is blocking the road</description> <status>created</status> <status_notes /> <policy>The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code</policy> </content> </entry> <entry> <id>tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637621.xml</id> <title>A large tree branch is blocking the road</title> <updated>2010-04-13T18:30:02-05:00</updated> <link rel="self" href="http://open311.sfgov.org/dev/V1/reports/637621.xml"/> <author><name>John Doe</name></author> <georss:point>40.7111 -73.9565</georss:point> <category label="Damaged tree" term="tree-damage" scheme="https://open311.sfgov.org/dev/V1/categories/006.xml">006</category> <content type="xml" ns="http://open311.org/spec/georeport-v1"> <report_id>637621</report_id> <address>1800 Market St, San Francisco, CA 94103</address> <description>A large tree branch is blocking the road</description> <status>created</status> <status_notes /> <policy>The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code</policy> </content> </entry> </reports>becomes{ "@ns": "http://www.w3.org/2005/Atom", "entry": [ { "author": { "name": "John Doe" }, "category": { "@label": "Damaged tree", "@scheme": "https://open311.sfgov.org/dev/V1/categories/006.xml", "@term": "tree-damage", "value": "006" }, "content": { "@ns": "http://open311.org/spec/georeport-v1", "@type": "xml", "address": "1600 Market St, San Francisco, CA 94103", "description": "A large tree branch is blocking the road", "policy": "The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code", "report_id": 637619, "status": "created", "status_notes": null }, "id": "tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637619.xml", "link": { "@href": "http://open311.sfgov.org/dev/V1/reports/637619.xml", "@rel": "self" }, "point": "40.7111 -73.9565", "title": "A large tree branch is blocking the road", "updated": "2010-04-13T18:30:02-05:00" }, { "author": { "name": "John Doe" }, "category": { "@label": "Damaged tree", "@scheme": "https://open311.sfgov.org/dev/V1/categories/006.xml", "@term": "tree-damage", "value": "006" }, "content": { "@ns": "http://open311.org/spec/georeport-v1", "@type": "xml", "address": "56 Market St, San Francisco, CA 94103", "description": "A large tree branch is blocking the road", "policy": "The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code", "report_id": 637620, "status": "created", "status_notes": null }, "id": "tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637620.xml", "link": { "@href": "http://open311.sfgov.org/dev/V1/reports/637620.xml", "@rel": "self" }, "point": "40.7111 -73.9565", "title": "A large tree branch is blocking the road", "updated": "2010-04-13T18:30:02-05:00" }, { "author": { "name": "John Doe" }, "category": { "@label": "Damaged tree", "@scheme": "https://open311.sfgov.org/dev/V1/categories/006.xml", "@term": "tree-damage", "value": "006" }, "content": { "@ns": "http://open311.org/spec/georeport-v1", "@type": "xml", "address": "1800 Market St, San Francisco, CA 94103", "description": "A large tree branch is blocking the road", "policy": "The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code", "report_id": 637621, "status": "created", "status_notes": null }, "id": "tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637621.xml", "link": { "@href": "http://open311.sfgov.org/dev/V1/reports/637621.xml", "@rel": "self" }, "point": "40.7111 -73.9565", "title": "A large tree branch is blocking the road", "updated": "2010-04-13T18:30:02-05:00" } ] }