List View conditional formatting of multienum fields

Hello all,
based on popular guide:

I would try to set conditional format of multienum field but seems not easy like enum or text.

With enum my custom style is:

$colour = substr(md5($bean->status),0,6);
        $bean->status = "<div style='padding: 0 0.2em 0 0.5em;border-radius: 4px;display: inline-block;color: #fefefe;background-color: #$colour; border: solid 2px #$colour;'>".$app_list_strings['contracts_status_list'][$bean->status]."</div>";

But with multieum this is not working:

        $statusTag = explode(",", $bean->status_tag);
        foreach($statusTag as $tag) {
            $tagPurified = trim($tag, '^');
            $statusTagField .= ",<span style='padding: 0 0.2em 0 0.5em;border-radius: 4px;display: inline-block;color: #fefefe;background-color: #$colour; border: solid 2px #$colour;'>".$app_list_strings['contracts_status_tag_list'][$tagPurified]." </span>";
        $bean->status_tag = ltrim($statusTagField,",");

Seems that multienum does not render html, please see attached image

Any help is highly appreciate!

Many thanks

You can make custom file:

  • custom/include/SugarFields/Fields/Multienum/ListView.tpl

Thanks Appreciate!

I will do a test on that

Does this way to formatting multienum can be applied only to specific module instead of all multienum of all modules?



There are some different ways for modules:

  • add tags and classes in the file custom/include/SugarFields/Fields/Multienum/ListView.tpl and load style in each module
  • write javascript for modify the field and load it in each module
  • use function fill_in_additional_list_fields in module, the example you can find in file modules/Contacts/Contact.php
  • maybe there are several other variants.

I would like to join this subject as I think it is a continuation. If no please move or delete.
I would like to know how to replace the default en translation to those set in my language for status dropdown.
When set they look like this
And after refresh back to default en

Thank You in advance.

This solution do not work in SuiteCRM 8 (it show html tags), is a bug or there is different solution?

Same question - is a bug or should set style in different way?

Hi @scicali & @maciej.geciow Is this when you are on the new Suite 8 List view? I suspect this would be the issue. Rendering of fields are done differently using the new framework, I would suggest creating a bug on the repo to identify the requirement.

All I can suggest for now is to utilise the Suite 8’s compatibility mode if you want to revert that list view back to using the Suite 7 framework/views that should still support your customisations… if not then that bug report would help :smiley: