Disable certain items from dropdown list

I’m looking for a simple functional way to remove disable certain items from a dropdown list; items that have been widely used in the past and are therefore still in use for records in the CRM.
I’m aware of how to delete an item from a list entirely via studio. This results however in empty values for records that use that particular dropdown item.

So probably the simplest would be to simply hide particular values from the dropdown list when the list is shown in the frontend (edit-view of the field), but SuiteCRM doesn’t entirely forget these values, and is therefore still able to properly display/interpret the legacy items in older records.

gracias.

Maybe this?

https://developer.sugarcrm.com/2011/08/24/howto-have-a-dropdown-field-that-gets-its-options-from-a-function/

If you get it working, write a nice tutorial for us and we can put it up on the Technical Blog in the new Documentation site. :slight_smile:

1 Like

That looks like it should work. I’ll give it a try. Not sure how soon…

thanks!

Looks to me like this would remove the hidden items from DetailView as well, which is not what I want.

Workaround:
=> I’d have to make a second version of the same field, which would refer to the custom function and use this version for Editview
=> I’d have to turn off Inline-Edit for the Detail- and Listview-version of the field.

Well so yes, I got it to work in principle. But it applies to search, list, detailview and editview. So no good for what I’m looking for.

(my suggested workaround makes no sense of course unless I then also add a logic hook to keep the two versions of the same field synchronized…

Any other ideas how to affect a dropdownlist ONLY in edit-mode of a dropdown field? (I just want to omit certain items from the list the user can choose from, without removing the item from the list entirely).

Sorry, this is out of my league… I hope somebody else answers you…

Any update about this, is there any possibility to disable dropdown items in edit mode and still be able to show it in readonly mode?

1 Like

Is your use case like this:

  • I want to delete un-used choices from the DropDown list
  • BUT - if I do that, existing records show blank, if they are the deleted values

This idea is a non-coding solution - maybe it has problems? - your thoughts?

  • create a new field, that is ‘Text’ type; set ‘inline edit’ off.
  • have it auto calculated from the DropDown field value (eg use a Suite ‘Workflow’ to update the field on every edit)
  • in all views except EDIT_view - in Studio select the new field instead of the dropdown
  • in EDIT_view - in Studio select the drop-down field.

The drawback, is this won’t work for Inline editing - hence have to set that ‘off’ in the field.

You’d also need at day 1 - to run a MySQL query, to populate the new field in every record - so not 100% code free solution.

1 Like

Ok, I was on the same track. Actually ma last question was about possible no-coding/configuration solution in studio. As this is not possible, I’ve had the same idea about solving it using secondary field and doing db migration of values.

Thank you for your feedback

BUT - Suite’s built in Workflow IS a no-code solution - all done in the GUI, as a regular user. That is no-code isn’t it - no PHP, no command-line at all?

Or am I missing something?

1 Like

No, you are right, except one-time SQL migration of the field. But, yes, you can do it without PHP coding, I agree,