Setting Custom Field during Ticket creation in Perl API (4.0.2)

I am trying to set a Custom Field Value during the creation of a ticket with the following piece of code. But the value (“SN-1234”) is not getting added to custom field
(BTW, I already pre created the Custom Field for the Ticket object and made it Global).

What am I doing wrong? Is SetIncludeContentForValue the correct API call?

my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Load(‘Store Number’);

unless ($cf->id) {
$RT::Logger->error( "Couldn’t load custom field " . “Store Number”);
}

$cf->SetIncludeContentForValue (“SN-1234”);

@retValues = $ticket->Create( Queue => ‘My Store Queue’, Subject => 'Test Ticket for Store 1234 ', CustomField => $cf);

Thanks

retrying… I am pretty sure there is someone in the community who can tell me what I am doing wrong …

I am trying to set a Custom Field Value during the creation of a ticket with the following piece of code. But the value (“SN-1234”) is not getting added to custom field
(BTW, I already pre created the Custom Field for the Ticket object and made it Global).

What am I doing wrong? Is SetIncludeContentForValue the correct API call?

my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Load(‘Store Number’);

unless ($cf->id) {
$RT::Logger->error( "Couldn’t load custom field " . “Store Number”);
}

$cf->SetIncludeContentForValue (“SN-1234”);

@retValues = $ticket->Create( Queue => ‘My Store Queue’, Subject => 'Test Ticket for Store 1234 ', CustomField => $cf);

Thanks

-------- RT Training Sessions (http://bestpractical.com/services/training.html) * Washington DC, USA ˜ October 31 & November 1, 2011 * Barcelona, Spain ˜ November 28 & 29, 2011

Hi,

Example from t/web/search_cf_quotes.t

17 RT::Test->create_tickets(
18 { Queue => ‘General’ },
19 { Subject => ‘ticket foo’, ‘CustomField-’ . $cf->id => ‘2011-09-15’ },
20 { Subject => ‘ticket bar’, ‘CustomField-’ . $cf->id => ‘2011-10-15’ },
21 { Subject => ‘ticket baz’ },
22 );

create_tickets sends most args into RT::ticket::Create without changes.

For sure SetIncludeContentForValue is not what you want.On Tue, Oct 18, 2011 at 8:20 PM, Srikumar Nair srikumarp@fb.com wrote:

retrying… I am pretty sure there is someone in the community who can tell
me what I am doing wrong …

I am trying to set a Custom Field Value during the creation of a ticket with
the following piece of code. But the value (“SN-1234”) is not getting added
to custom field
(BTW, I already pre created the Custom Field for the Ticket object and made
it Global).
What am I doing wrong? Is SetIncludeContentForValue the correct API call?

my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Load(‘Store Number’);
unless ($cf->id) {
$RT::Logger->error( "Couldn’t load custom field " . “Store Number”);
}
$cf->SetIncludeContentForValue (“SN-1234”);
@retValues = $ticket->Create( Queue => ‘My Store Queue’, Subject => 'Test
Ticket for Store 1234 ', CustomField => $cf);

Thanks

~

~

~

~
-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Washington DC, USA ˜
October 31 & November 1, 2011 * Barcelona, Spain ˜ November 28 & 29, 2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Washington DC, USA — October 31 & November 1, 2011
  • Barcelona, Spain — November 28 & 29, 2011

Best regards, Ruslan.

Thanks Ruslan. Where can I find the file t/web/search_cf_quotes.t? Is it
part of the RT distribution?On 10/18/11 9:33 AM, “Ruslan Zakirov” ruz@bestpractical.com wrote:

Hi,

Example from t/web/search_cf_quotes.t

17 RT::Test->create_tickets(
18 { Queue => ‘General’ },
19 { Subject => ‘ticket foo’, ‘CustomField-’ . $cf->id =>
‘2011-09-15’ },
20 { Subject => ‘ticket bar’, ‘CustomField-’ . $cf->id =>
‘2011-10-15’ },
21 { Subject => ‘ticket baz’ },
22 );

create_tickets sends most args into RT::ticket::Create without changes.

For sure SetIncludeContentForValue is not what you want.

On Tue, Oct 18, 2011 at 8:20 PM, Srikumar Nair srikumarp@fb.com wrote:

retrying… I am pretty sure there is someone in the community who can
tell
me what I am doing wrong …

I am trying to set a Custom Field Value during the creation of a ticket
with
the following piece of code. But the value (“SN-1234”) is not getting
added
to custom field
(BTW, I already pre created the Custom Field for the Ticket object and
made
it Global).
What am I doing wrong? Is SetIncludeContentForValue the correct API
call?

my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Load(‘Store Number’);
unless ($cf->id) {
$RT::Logger->error( "Couldn’t load custom field " . “Store Number”);
}
$cf->SetIncludeContentForValue (“SN-1234”);
@retValues = $ticket->Create( Queue => ‘My Store Queue’, Subject =>
'Test
Ticket for Store 1234 ', CustomField => $cf);

Thanks

~

~

~

~
-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Washington DC, USA —
October 31 & November 1, 2011 * Barcelona, Spain — November 28 & 29,
2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Washington DC, USA ‹ October 31 & November 1, 2011
  • Barcelona, Spain ‹ November 28 & 29, 2011


Best regards, Ruslan.

Thanks Ruslan. Where can I find the file t/web/search_cf_quotes.t? Is it
part of the RT distribution?

It is part of RT’s test suite that is distributed, but not installed.
There are a lot
of examples in it.> On 10/18/11 9:33 AM, “Ruslan Zakirov” ruz@bestpractical.com wrote:

Hi,

Example from t/web/search_cf_quotes.t

17 RT::Test->create_tickets(
18 { Queue => ‘General’ },
19 { Subject => ‘ticket foo’, ‘CustomField-’ . $cf->id =>
‘2011-09-15’ },
20 { Subject => ‘ticket bar’, ‘CustomField-’ . $cf->id =>
‘2011-10-15’ },
21 { Subject => ‘ticket baz’ },
22 );

create_tickets sends most args into RT::ticket::Create without changes.

For sure SetIncludeContentForValue is not what you want.

On Tue, Oct 18, 2011 at 8:20 PM, Srikumar Nair srikumarp@fb.com wrote:

retrying… I am pretty sure there is someone in the community who can
tell
me what I am doing wrong …

I am trying to set a Custom Field Value during the creation of a ticket
with
the following piece of code. But the value (“SN-1234”) is not getting
added
to custom field
(BTW, I already pre created the Custom Field for the Ticket object and
made
it Global).
What am I doing wrong? Is SetIncludeContentForValue the correct API
call?

my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Load(‘Store Number’);
unless ($cf->id) {
$RT::Logger->error( "Couldn’t load custom field " . “Store Number”);
}
$cf->SetIncludeContentForValue (“SN-1234”);
@retValues = $ticket->Create( Queue => ‘My Store Queue’, Subject =>
'Test
Ticket for Store 1234 ', CustomField => $cf);

Thanks

~

~

~

~
-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Washington DC, USA —
October 31 & November 1, 2011 * Barcelona, Spain — November 28 & 29,
2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Washington DC, USA ‹ October 31 & November 1, 2011
  • Barcelona, Spain ‹ November 28 & 29, 2011


Best regards, Ruslan.

Best regards, Ruslan.