Adding a variable array as a field

My requirement is as follows

  1. Each Products can have multiple features - each feature is essentially a string
  2. User should be able to add features at run-time to any product
  3. When user is creating quote - he/she can select which features are added to the product
  4. When a user views a product - the feature list is displayed - and the user can add, edit or remove features of a product.

I am thinking of extending the Products module. But i am not sure what will be the “Features” -
Option 1> Features is a separate module and I create one-to-many relationship between Product and Features
Option 2> Feature is a custom field -

I would prefer choosing Option 2 (Since feature would not have its own properties, don’t see the need for a module)- but how do I create a variable array field type …

Any pointers would be helpful.

Maybe what you’re looking for is a dropdown (of the kind you can configure in Admin/Dropdown editor)?

The dropdown values (Multiselect) can only be set from the Admin menu - or is there a way to let the drop-down values be added deleted by normal users?

We need normal sales people to be able to add/remove/edit the product features
Also, when products are added to quotes, they can omit certain values ( not really delete the feature from products) but select which features are added to a specific quote

The dropdown values (or Multiselect) can only be set from the Admin menu - or is there a way to let the drop-down values be added deleted by normal users?

We need normal sales people to be able to add/remove/edit the product features
Also, when products are added to quotes, they can omit certain values ( not really delete the feature from products) but select which features are added to a specific quote

Ok, then go for a relate field. This will actually create a relationship, but it will be much simpler in terms of UI than a full-blown relationship with subpanels.

Thanks. So if i have to create a relate field, i have to create Features as a full blown custom module - or atleast a module with a database table supporting the entries?
Is there any other way to create a relate field with a Array variable - for example the features are Array(String) stored in a table - and the product<-> feature is a relation table with product-id and feature-id entries ?

Just try the relate field, I think it will work well for you. Make a simple custom module with only one column if that’s all you need. Then add the relate field to your other module.

You get all the necessary screens to handle the Product features, you get all the power of the list views (import/export/filter etc), you get Security Groups to handle permissions, etc.

And your relate field will have “find-as-you-type” as you’re filling it.

So obviously I did something wrong with the relate field.
Here are the steps that i executed

  1. Created a package - ModTest (key MT)
  2. Created a module (derived from Basic) - ProductFeatures - only one column name
  3. Created a module (derived from Basic) - ProductTest
  4. Deployed TestModules ( without this step, I can’t relate ProdFeatures as a field in ProductTest)
  5. Went back to studio to edit “TestModules”
  6. Add a field to ProductTest - type “relate”
  7. Now I can see the module “ProdFeatures” in the “relate” dropdown
  8. When I save, it throws an error dialog

==================================
Notice: Undefined index: MT_ProductFeatures in D:\dev_wksd\projects\INTERFACE-TECHNOLOGIES\CRM\crm\modules\DynamicFields\templates\Fields\TemplateRelatedTextField.php on line 319
{“center”:{“title”:“Fields”,“crumb”:"""</a> “”</a> | Module Builder</a> > ModTest</a> > ProductTest</a> > Fields</span>

“,“content”:”\n\n
\n
\n\n</div>\n\n
\n\n
</div>\n\n

The dialog box has two button “Add Field” and “Edit Field”

When I go back to studio the field is actually added

You must be using XAMPP, am I right?

Turn off display_errors in your php.ini, and restart web server. This should fix your on-screen errors, which seem to break everything in XAMPP.

So i have made some progress- but seem to have hit a road-block. Relate fields are single select.

So The Product module has a relate field which is Feature Module - but for each Product I can choose only one Feature - I should be able to select multiple features for same product.

Any pointers?

Sorry, I got lost in your requirements and I gave you inadequate advice.

If it needs to be one-to-many then the relate field won’t do, you need a full blown relationship and you can manage each related records as an individual line in a subpanel.

Thanks.

I was looking at the “Accounts” module - and it has “email” address field - and i can add as many email address as possible - so i looked up the table structure and there is an “email_addresses” table and “email_addr_bean_rel” table.

So, my question is - is the following a very complex convoluted solution-

  1. create a table structure similar to that of “email_addr_bean_rel” for product-features relation
  2. create a custom “field type” say - type ArrayEntities - which relates one module to another but can be a variable array
  3. provide an option in the front-end to link the features to products at run time

How complex is this? Is there any starting documentation / forum-post that will give me a good headstart?

Thanks again

For that kind of solution you will be happy to find this exists and is ready to use:

https://suitecrm.com/suitecrm/forum/developer-help/12771-dynamic-fields-plugin

Note that this will limit you to a small number of items (otherwise the UI is impractical), but if that’s ok with you, go ahead :slight_smile: