[Rt-devel] Problem with DefaultCustomFieldValue
Juan Ramón Alfageme Mata
JRamon.Alfageme at alhambra-eidos.com
Tue Mar 1 05:37:41 EST 2005
Still not working, I tried following code as global script:
Condition: On Transaction
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate
Custom condition:
Custom action preparation code:
my $CFName = 'Provider';
my $DefaultValue = 'BT';
my $CustomFieldsObj = $self->TicketObj->QueueObj->CustomFields();
while ( my $CustomFieldObj = $CustomFieldsObj->Next() ) {
next unless ( $CustomFieldObj->Name = $CFName ) {
my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue( Field => CustomFieldObj, Value => $DefaultValue );
}
return 1;
Custom action cleanup code: return 1;
It seems correct but I don't now why It isn't working, AddCustomFieldValue seems to be the correct method because API says:
"AddCustomFieldValue { Field => FIELD, Value => VALUE }
VALUE should be a string. FIELD can be a CustomField object OR a CustomField ID.
Adds VALUE as a value of CustomField FIELD. If this is a single-value custom field, deletes the old value. If VALUE isn't a valid value for the custom field, returns (0, 'Error message' ) otherwise, returns (1, 'Success Message')"
"If VALUE isn't a valid value for the custom field" makes me think that VALUE must be valid because this method sets the custom field value to VALUE.
Thanks for your patience and help.
Juan Ramón Alfageme Mata
+34 91 787 23 00 alhambra-eidos.com
More information about the Rt-devel
mailing list