Kernel::System::DynamicFieldValue
DynamicField values backend
create a DynamicFieldValue object. Do not use it directly, instead use:
my $DynamicFieldValueObject = $Kernel::OM->Get('Kernel::System::DynamicFieldValue');
sets a dynamic field value. This is represented by one or more rows in the dynamic_field_value table, each storing one text, date and int field. Please see how they will be returned by "ValueGet()".
my $Success = $DynamicFieldValueObject->ValueSet( FieldID => $FieldID, # ID of the dynamic field ObjectID => $ObjectID, # ID of the current object that the field # must be linked to, e. g. TicketID Value => [ { ValueText => 'some text', # optional, one of these fields must be provided ValueDateTime => '1977-12-12 12:00:00', # optional ValueInt => 123, # optional }, ... ], UserID => $UserID, );
get a dynamic field value. For each table row there will be one entry in the result list.
my $Value = $DynamicFieldValueObject->ValueGet( FieldID => $FieldID, # ID of the dynamic field ObjectID => $ObjectID, # ID of the current object that the field # is linked to, e. g. TicketID ); Returns [ { ID => 437, ValueText => 'some text', ValueDateTime => '1977-12-12 12:00:00', ValueInt => 123, }, ];
delete a Dynamic field value entry. All associated rows will be deleted.
my $Success = $DynamicFieldValueObject->ValueDelete( FieldID => $FieldID, # ID of the dynamic field ObjectID => $ObjectID, # ID of the current object that the field # is linked to, e. g. TicketID UserID => 123, ); Returns 1.
delete all entries of a dynamic field .
my $Success = $DynamicFieldValueObject->AllValuesDelete( FieldID => $FieldID, # ID of the dynamic field UserID => 123, ); Returns 1.
Delete all entries of a dynamic field values for object ID.
my $Success = $DynamicFieldValueObject->ObjectValuesDelete( ObjectType => 'Ticket', # Dynamic Field object type ( e. g. Ticket, Article, FAQ) ObjectID => $ObjectID, # ID of the current object that the field # is linked to, e. g. TicketID UserID => 123, ); Returns 1.
checks if the given value is valid for the value type.
my $Success = $DynamicFieldValueObject->ValueValidate( Value => { ValueText => 'some text', # optional, one of these fields must be provided ValueDateTime => '1977-12-12 12:00:00', # optional ValueInt => 123, # optional }, UserID => $UserID, );
get all distinct values from a field stored on the database
my $HistoricalValues = $DynamicFieldValueObject->HistoricalValueGet( FieldID => $FieldID, # ID of the dynamic field ValueType => 'Text', # or 'DateTime' or 'Integer'. Default 'Text' ); Returns: $HistoricalValues{ ValueA => 'ValueA', ValueB => 'ValueB', ValueC => 'ValueC' };
Searches/fetches dynamic field value.
my $Value = $DynamicFieldValueObject->ValueSearch( FieldID => 142, # ID of dynamic field to search Search => 'test', SearchSQL => "dynamic_field_value.value_text = 'test'", ); Returns [ { ID => 437, FieldID => 123, ObjectID => 133, ValueText => 'some text', ValueDateTime => '1977-12-12 12:00:00', ValueInt => 123, }, # ... ];
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.