Print Multiselect field in PDF as UL list

Hi, do you know if it’s possible to change code so that i can print a multiselect field, when i genereate a pdf, as a UL List?

Thanks,

Mayer

Hi Mayer,

I don’t think this is possible out of the box. You may be able to customise and do an if/for statement and wrap each multiselect value in li tags inside the ul.

Thanks,

Will.

1 Like

Hi Will,
ok, thank you.

Where do you think i have to customize the code?

Also looking into this as well so please let me know if you find anything.

I have tried changing the list view of the multienum field type, but afraid it didn’t work.
/include/SugarFields/Fields/Multienum/ListView.tpl

{$vardef.options_list.$item}{if !$smarty.foreach.multiEnum.last},
{$vardef.options_list.$item}{if !$smarty.foreach.multiEnum.last}

Possibly a custom field in the module where you replace the ^,^ with a
in your field.

This is possible but what you would need to do is get the $app_list_strings definition for your multiselect and then put the array values into the string that creates the bulk of the pdf. You would do this by editing custom/modules/AOS_PDF_Templates/generatePdf.php


//Get the drop down values
$values =   $app_list_strings['YOUR_FIELD_KEY'];
$ul = '<ul>'
foreach($values as $key => $value){

	$ul .= '<li>'.$value.</li>

}
$ul .= '</ul>;'

1 Like

Thank you Andy,

i’m studying the modules/AOS_PDF_Templates/generatePdf.php

Have i to modify after:

$printable = str_replace("\n","<br />",$converted);

?

I tried to do this, didn’t work:

in custom/modules/AOS_PDF_Templates/generatePdf.php

//Get the drop down values
$values =   $app_list_strings['analyzerresult_c'];
$ul = '<ul>'
foreach($values as $key => $value){
        $ul .= '<li>'.$value.</li>
}
$ul .= '</ul>';

In the YOUR_FIELD_KEY tried:’(analyzerresult_c and $leads_analyzerresult_c). None convert them to values.

How can I do this?

This solved the issue:

https://github.com/salesagility/SuiteCRM/commit/a70d66a

1 Like

I have my code as there but it doesn’t work anyway

What occurs to me is to make a textarea field for each multiselect and in the hook save the values there
Then in the pdf use those hidden fields to print