How to convert default description field into WYSIWYG editor for task module

Hi All,

For converting the default description field into WYSIWYG editor, I used the below code.

Path -custom/Extension/modules/Tasks/Ext/Vardefs/sugarfield_description.php -
$dictionary[‘Task’][‘fields’][‘description’][‘type’]=‘WYSIWYG’;

But when I do repair and rebuilt, I am getting an error mentioned below -

/* Table : tasks */
/*COLUMNS*/
/*MISMATCH WITH DATABASE - description -  ROW [name] => 'description'  [type] => 'text'  */
/* VARDEF - description -  ROW[name] => 'description'  [vname] => 'LBL_DESCRIPTION'  [type] => 'WYSIWYG'  [comment] => 'Full text of the note'  [rows] => '6'  [cols] => '80'  [inline_edit] => '1'  [help] => 'Enter The Description Of The Note'  [comments] => 'Full text of the note'  [merge_filter] => 'disabled'  [dbType] => 'WYSIWYG'  [len] => ''  [required] => ''  */
/* INDEXES */
ALTER TABLE tasks   modify COLUMN description WYSIWYG  NULL ;

and if I execute it, getting Database failure error.

can anyone suggest an upgrade safe solution for the same?

I tried below solution as well, but it is not working
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/Architecture/TinyMCE/

Thanks in Advance.

I think this was merged for 7.11 but not for 7.10, you can always apply it there if you need it.

Hi @pgr, Thanks for the reply.

my version is - 7.11.10, and I checked it is already updated. I don’t know why it is giving database failure error.

Which version of MySQL are you running?

My MySQL version is 5.7

Try this at custom/Extension/modules/Tasks/Ext/Vardefs/sugarfield_description.php -

$dictionary[‘Task’][‘fields’][‘description’][‘type’]=‘wysiwyg’;
$dictionary[‘Task’][‘fields’][‘description’][‘dbtype’]=‘text’;

Do quick repair and rebuild.

4 Likes

Hi @sagarjaydeep,

Thanks a lot @sagarjaydeep, it worked perfectly fine in my local setup.

But no clue when i use same code on staging setup, it is creating a text field rather than WYSIWYG editor.

error log -
SugarBean::populateDefaultValues $field_defs should be an array

createRelationshipMeta: Metadata for table does not exist

I believe above error are not relevant to that issue.
It may be file permission or file name case sensitive issue.

I checked file name, i cant see any difference
can you guide me what permission i should give.

write permission is already there.

Hello Team .

I have also facing same issues . In local It’s working fine. But when code deployed on server . It’s display like text box.

I got same issue , After debugging , i did some changes in the code .

create custom view and add code in view.edit.php.

parent::display();
            echo  "<script>$(document).ready(function(){"
                . "tinyMCE.init({'height':250,'menubar':false,'plugins':'code, table, link, image, wordcount, media, imagetools, template, anchor, codesample, fullscreen','selector':'#EditView #description','toolbar1':'fontselect | fontsizeselect | bold italic underline | forecolor backcolor | styleselect | fullscreen | outdent indent | link image | code table | image media template link anchor codesample'})
                tinyMCE.init({'height':250,'menubar':false,'plugins':'code, table, link, image, wordcount, media, imagetools, template, anchor, codesample, fullscreen','selector':'#EditView #update_text','toolbar1':'fontselect | fontsizeselect | bold italic underline | forecolor backcolor | styleselect | fullscreen | outdent indent | link image | code table | image media template link anchor codesample'})
              });
          </script>";

Please change field Id in JS code.

Excellent ! - I tried this code to convert the existing text area field into a WYSIWYG field type in another module , Projects, and it worked!

<?php
 // created: 2018-05-09 16:49:39
$dictionary['Project']['fields']['description']['inline_edit']=true;
$dictionary['Project']['fields']['description']['comments']='Project Notes';
$dictionary['Project']['fields']['description']['merge_filter']='disabled';
$dictionary['Project']['fields']['description']['rows']='4';
$dictionary['Project']['fields']['description']['cols']='20';
$dictionary['Project']['fields']['description']['type']='wysiwyg';
$dictionary['Project']['fields']['description']['dbtype']='text';

 ?>

Now the converted field in list view of Projects it seems to to show HTML codes, If, however, I add a new field and display it in list view it shows nice formatting.
Anyone know a setting or code edit to fix that??


Added below code but I am getting error.

<?php

    $dictionary['MODULE']['fields']['description']['type']='wysiwyg';
    $dictionary['MODULE']['fields']['description']['dbtype']='text';

?>

Console error:

tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9 Uncaught Error: Syntax error, unrecognized expression: # #description
at sa.error (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:68110)
at sa.tokenize (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:74265)
at sa.select (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:76268)
at sa (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:62947)
at Object.select (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:92150)
at tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:381021
at Object.t (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:381504)
at ci.executeHandlers (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:59612)
at o (tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:56746)
at tinymce.min.js?v=6WY0eIRvQx-xSuYs2iwxMg:9:57804