Custom Fields (encrypt)

Suitecrm 7.5

I’m having a hell of a time figuring out how to add custom fields. I want an encrypted field. I’ve got the template in suitecrm/modules/DynamicFields/templates/Fields/

ive added the language file to
/suitecrm/custom/Extension/modules/Leads_/Ext/Language

containing

<?php $mod_string['fieldtypes']['encrypt'] = 'encrypt'; I've done a rebuild and I still do not have the option of creating encrypted fields.

You can simply add custom fields to modules using Studio(located in Admin -> Studio).

This will build all of the language/definitions.

Thanks,

Will.

I think Will thought you were trying to add a new field of an existing type rather than a new field type going by his answer.

There are three places you need to make changes to add a custom field type.

You say you’ve added the field to modules/DynamicFields/templates/Fields. I’ll presume you’ve done this correctly, but ideally you should move this to custom/modules/DynamicFields/templates/Fields to make it upgrade safe.

You also need to add a file to custom/Extension/modules/ModuleBuilder/Ext/Language (replace the bit in caps with appropriate values)


<?php

$mod_strings['fieldTypes']['VALUE YOU SET TYPE TO IN TEMPLATE['] = 'LABEL FOR FIELD TYPE THAT WILL BE DISPLAYED IN STUDIO';

Thirdly, you need to add a directory to custom/include/SugarFields/Fields/yourfieldname with any smarty templates you require and a class for your field type which extends an existing type. You could leave this class empty or add any code you need to it. If you look at the default field types in include/SugarFields/Fields it will give you a few examples to base your code on.

Finally you will need to do a repair and rebuild before you see the file type in Studio

I ran across the same issue. Ive been trying to document things like this as I come across them because my memory is only so good.

https://suitecrm.com/forum/developer-help/7453-creating-custom-field-types

I have a solid example there of how to add a custom field type. My only issue is the logic that is ran for that field as a custom field type when it comes to inline editing.