Setting default custom field value using initialdata & rt-setup-database

Dear community,

I am trying to set the default value for a custom field during database initialization (rt-setup-database action --init). The custom field looks like the following in the initialdata file :

{
    Name              => 'Is fetched by IntelMQ',
    Description       => 'IntelMQ_Fetched',
    Type              => 'SelectSingle',
    Queue             => 'Incidents',
    Pattern           => '(?#Mandatory).',

    Values => [
    {Name => 'No', SortOrder => 1},
    {Name => 'Yes', SortOrder => 2},
    ],
}

I want the custom field to be set as ‘No’ by default but the only way I found was to set it manually using the WebUI. I suspect that we can do such a thing by modifying the @Attributes variable in the initialdata, but I cannot find any documentation about this topic on the Internet. Did somebody already find the right way to do it ?

Looking forward a positive answer :slight_smile: !

Cheers,

Henri

Hi Henri,

This is how we do it:

@Attributes = (
{ Name => ‘CustomFieldDefaultValues’,
Content => {
‘10’ => ‘Yes’,
},
},
);

Set customfield 10 to Yes as the default

Best Regards

Martin

It worked fine,

Thanks a lot Martin !