GlideDynamicAttribute : Global
Die GlideDynamicAttribute -API bietet Zugriff auf dynamische Attributmetadaten.
Diese API stellt Methoden bereit, mit denen Sie dynamische Schemawerte abrufen können, die in der Tabelle „Dynamisches Attribut“ [dynamic_attribute] definiert sind. Dynamische Attribute haben einen definierten Datentyp und eine sys_id. Weitere Informationen zu dynamischen Attributen finden Sie unter Dynamisches Schema. Die gleichen Methoden sind auch für vorübergehende dynamische Attribute in der GlideTransientDynamicAttribute : Global API verfügbar.
Um diese API zum Erstellen dynamischer Attribute zu verwenden, benötigen Sie die Rolle „dynamic_schema_writer“. Um dynamische Daten mit dieser API zu lesen, benötigen Sie die Rolle „dynamic_schema_reader“.
GlideDynamicAttribute – getGroupName()
Ruft den Wert der Gruppennamen-Eigenschaft eines dynamischen Attributobjekts ab.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Wert der Gruppennameneigenschaft des dynamischen Attributs. Siehe auch Create a dynamic attribute group. |
Im folgenden Beispiel wird der Wert des dynamischen Attributobjektgruppennamens alsangezeigt.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getName()
Ruft den Wert der Namenseigenschaft eines dynamischen Attributobjekts ab.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Wert der Namenseigenschaft des dynamischen Attributs. |
Im folgenden Beispiel wird der Wert des dynamischen Attributobjektnamens als cangezeigt.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getPath()
Ruft den Wert der Pfadeigenschaft eines dynamischen Attributobjekts ab.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Wert des Pfads des dynamischen Attributs. |
Im folgenden Beispiel wird der Wert des dynamischen Attributobjektpfads als a->cangezeigt.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getSysId()
Ruft die sys_id eines dynamischen Attributobjekts ab.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Wert der sys_id des dynamischen Attributs. |
Im folgenden Beispiel wird der Wert der sys_id des dynamischen Attributobjekts als 8bc411a94fc01210b8ddc0e552ce0b3cangezeigt.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getType()
Ruft den Wert der Typeigenschaft eines dynamischen Attributobjekts ab.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Wert des Datentyps des dynamischen Attributs. |
Im folgenden Beispiel wird der Wert des Objekttyps „dynamisches Attribut“ als Ganzzahlangezeigt.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – isTransient()
Gibt zurück, ob ein Objekt ein vorübergehendes dynamisches Attribut ist.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | Kennzeichnung, die angibt, ob ein dynamisches Attribut vorübergehend ist. Gültige Werte:
Hinweis: Auf die Tabelle „Dynamisches Attribut“ [dynamic_attribute] können Sie zugreifen, indem Sie zu navigieren , wählen Sie eine Gruppe und dann die Registerkarte Dynamische Attribute aus. |
Im folgenden Beispiel gibt die Methode isTransient() für das nichtflüchtige Objekt „false“ zurück.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Ausgabe:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string