i have a custom module Sample Management. I want to create a file type field in editviewdef.php so that i can upload the file and download it from the detailed view whenever needed. Would anyone tell me the steps how to proceed for this task?
Creating New Modules Module Builder functionality is managed within the 'Developer Tools' section of Sugar's administration console. Upon selecting 'Module Builder', the user has the option of creating a "New Package".
SugarCRM provides you with various tools to make our customizable CRM software your own. Create custom layouts, relationships, and fields – all of these without writing a line of code. Use Sugar Studio to customize your Sugar instance as well as the Self-service Portal.
If you are creating the module through Module Builder, just add 'file' => 1, to the 'templates' array in $config variable (config.php). Then you'll be able to add a new upload file field to your editviewdefs.php:
1 =>
array (
'name' => 'uploadfile',
'displayParams' =>
array (
'onchangeSetFileNameTo' => 'document_name',
),
),
Don't forget to add the form and javascript elements to the templateMeta array in editviewdefs.php:
'form' =>
array (
'enctype' => 'multipart/form-data',
'hidden' =>
array (
),
),
'javascript' => '<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/sugar_grp_jsolait.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/Documents/documents.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>',
You also need to add the uploadfile field to detailvidefs.php:
1 =>
array (
'name' => 'uploadfile',
'displayParams' =>
array (
'link' => 'uploadfile',
'id' => 'id',
),
),
Hope this helps!
What you need to do is create a custom SugarField type by:
I can definitely verify that there is a file field type as of SugarCRM 6.4.1, once you define how the field is laid out, you should be able to use it seamlessly with the rest of the CRM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With