Tuesday, April 2, 2013
Copy Field into Related SubPanel
Copy Fields from parent module to related module at real time,
e.g : Need to create case from contacts and want contact field fill in new created case.
Steps => 1
Go to studio and create related field of Contacts in Case module.
Make this field in Edit View, Detail View and Quick Create view.
Steps =>2
Go to SugarCRM/include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php
At line 128, place below code:
if(strtolower($defines['child_module_name']) =='cases') {
if(strtolower($defines['parent_bean_name']) == 'contact' ){
if(isset($defines['focus']->id))$additionalFormFields['contact_id_c'] = $defines['focus']->id;
if(isset($defines['focus']->name))$additionalFormFields['contact_person_c'] = $defines['focus']->name;
}
}
where contact_id_c and contact_person_c is the my new field id and name
Labels:
SugarCRM
Location:
Daman and Diu, India
Tuesday, March 19, 2013
Add Field in Address
1) make fields name area_c by studio in contacts and accounts and leads
2) change in /include/SugarFields/Fields/Address/EditView.tpl
add line one line after country
{{assign var="area" value=$displayParams.key|cat:'_address_area_c'}}
after that add one TR :
<tr>
<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
{sugar_translate label='LBL_AREA' module='{{$module}}'}:
{if $fields.{{$area}}.required || {{if $area|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>
2) change in /include/SugarFields/Fields/Address/EditView.tpl
add line one line after country
{{assign var="area" value=$displayParams.key|cat:'_address_area_c'}}
after that add one TR :
<tr>
<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
{sugar_translate label='LBL_AREA' module='{{$module}}'}:
{if $fields.{{$area}}.required || {{if $area|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>
add one line like,
address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
{$fields.{{$displayParams.key}}_address_area_c.value}|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
</td>
_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
{$fields.{{$displayParams.key}}_address_area_c.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
<br>
{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
</td>
<td>
<input type="text" name="{{$postalcode}}" id="{{$postalcode}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$postalcode}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>
<!--tr>
<tr>
<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class="dataLabel" >
{sugar_translate label='Area' module='{{$module}}'}:
{{if $area|lower|in_array:$displayParams.required}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{{/if}}
</td>
<td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' class='tabEditViewDF' >
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr-->
<tr>
<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
{sugar_translate label='Area' module='{{$module}}'}:
{if $fields.{{$area}}.required || {{if $area|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>
<tr>
<td id="{{$country}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
Subscribe to:
Posts (Atom)