Create a CustomField and Apply it Globally

Dear RT-Developpers

I have a problem applying a CustomField in a Scrip I created.

I like to create dynamically create CustomFields and Apply them Globally.

The RT::CustomField->Cerate() Code below works …

But I have to ApplyGlobally manually via :

$WebURL/rt/Admin/CustomFields/Objects.html

because I’m unable to understand how to deal with

RT::CustomField->ApplyGlobally

Can you send me an Example how to deal with ApplyGlobally ?

Thanks sincerely,

— MY CODE —#

my $cf = RT::CustomField->new( RT::SystemUser );

my ( $cf_val, $cf_msg ) = $cf->Create(
Name => ‘NAME_FROM_DB’,
TypeComposite => ‘Freeform-1’,
LookupType => ‘RT::Queue-RT::Ticket’,
Description => ‘DESCRIPTION_RETRIVED_FROM_DB’,
Pattern => ‘’,
LinkValueTo => ‘’,
IncludeContentForValue => ‘’,
BasedOn => ‘’,
Disabled => 0,
);

Please help me here ???

$cf = RT::CustomField->new( RT::SystemUser );
$cf->Load( Id => $cf_val );
$cf->ApplyGlobally;

Dear RT-Users

I have a problem applying a CustomField in a Scrip I created.

I like to create dynamically create CustomFields and Apply them Globally.

The RT::CustomField->Cerate() Code below works …

But I have to ApplyGlobally manually via :

$WebURL/rt/Admin/CustomFields/Objects.html

because I’m unable to understand how to deal with

RT::CustomField->ApplyGlobally

Can you send me an Example how to deal with ApplyGlobally ?

Thanks sincerely,

— MY CODE —#

my $cf = RT::CustomField->new( RT::SystemUser );

my ( $cf_val, $cf_msg ) = $cf->Create(
Name =>
‘NAME_FROM_DB’,
TypeComposite => ‘Freeform-1’,
LookupType => ‘RT::Queue-RT::Ticket’,
Description => ‘DESCRIPTION_RETRIVED_FROM_DB’,
Pattern => ‘’,
LinkValueTo => ‘’,
IncludeContentForValue => ‘’,
BasedOn => ‘’,
Disabled =>
0,
);

Please help me here ???

$cf = RT::CustomField->new( RT::SystemUser );
$cf->Load( Id => $cf_val );
$cf->ApplyGlobally;

because I’m unable to understand how to deal with

RT::CustomField->ApplyGlobally

Check the docs for ApplyGlobally:
http://bestpractical.com/rt/docs/latest/RT/CustomField.html#ApplyGlobally
It does not apply a custom field globally, it tells you about the CF.

I suspect you want
http://bestpractical.com/rt/docs/latest/RT/CustomField.html#AddToObject-OBJECT
and to look at how share/html/Admin/CustomFields/Objects.html does it

-kevin

Thanks

AddToObject solved my Problem :wink:

From: Kevin Falcone falcone@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, October 25, 2012 5:28 AM
Subject: Re: [rt-users] Fw: [rt-devel] Create a CustomField and Apply it Globally

because I’m unable to understand how to deal with

RT::CustomField->ApplyGlobally

Check the docs for ApplyGlobally:
http://bestpractical.com/rt/docs/latest/RT/CustomField.html#ApplyGlobally
It does not apply a custom field globally, it tells you about the CF.

I suspect you want
http://bestpractical.com/rt/docs/latest/RT/CustomField.html#AddToObject-OBJECT
and to look at how share/html/Admin/CustomFields/Objects.html does it

-kevin

Thanks sincerely,

— MY CODE —#

my $cf = RT::CustomField->new( RT::SystemUser );

my ( $cf_val, $cf_msg ) = $cf->Create(
Name => ‘NAME_FROM_DB’,
TypeComposite => ‘Freeform-1’,
LookupType => ‘RT::Queue-RT::Ticket’,
Description => ‘DESCRIPTION_RETRIVED_FROM_DB’,
Pattern => ‘’,
LinkValueTo => ‘’,
IncludeContentForValue => ‘’,
BasedOn => ‘’,
Disabled => 0,
);

Please help me here ???

$cf = RT::CustomField->new( RT::SystemUser );
$cf->Load( Id => $cf_val );
$cf->ApplyGlobally;

Final RT training for 2012 in Atlanta, GA - October 23 & 24
http://bestpractical.com/training

We’re hiring! Careers — Best Practical Solutions