[rt-users] Setting Custom Field during Ticket creation in Perl API (4.0.2)

Ruslan Zakirov ruz at bestpractical.com
Tue Oct 18 12:33:52 EDT 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 at 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.



More information about the rt-users mailing list