Autofill Field in SugarCRM - sugarcrm

In Quotes module (SugarCRM Pro) i made one field region (drop down). When we select billing account name in quote name then address automatically fill up . I want that region field will automatically fill up as i have made same region in account module . I want it will automatically fetch the region from the account module as it fetch all the address.

in your editviewdefs for that module, on the field array element, you need to add something like:
'displayParams' => array( 'field_to_name_array' => array( 'FIELDFROMACCOUNTS' => 'FIELDTOPOPULATE', 'FIELDFROMACCOUNTS2' => 'FIELDTOPOPULATE2'),),
Replace the all caps words with your fields and you should be ready to go. Keep in mind that relate fields have a hidden field that is used for the ids and make sure that you are populating it properly.
Cheers.

Related

SuiteCRM increase autocomplete time in EditView

I'm looking at a request from our customer to either lengthen the autofill or just remove it all together when adding an organisation in EditView.
e.g: https://demo.suiteondemand.com/index.php?module=Opportunities&action=EditView&return_module=Opportunities&return_action=DetailView
If you start typing into "Account Name" box 'A' it'll show all the Organisations starting with A but also it'll autofill the first result into the input box.
Is there a way to stop that autofill of the input box from happening or delay it?
Thanks
Edit: changed title to SuiteCRM
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Quicksearch/
I used the Metadata example, and it worked.
[Edit]
To expand on the answer. If you want to remove autofill from any of the boxes you need to add the 'sqsNoAutofill' to achieve this you can do the following:
In a modules editviewdefs.php (e.g. modules/(module)/metadata/editviewdefs.php) locate the name of the input you wish to change e.g:
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
),
then add the following:
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
'displayParams' => array (
'class' => 'sqsEnabled sqsNoAutofill'
)
),
This will stop an input box with a quicksearch drop down from autofilling.
You can also make the change to the SugarField for Parent
include/SugarFields/Fields/Parent/EditView.tpl (line 51):
<input type="text" .... class="sqsEnabled sqsNoAutofill" .....>
I hope that helps someone else.

How to add Gravity Forms fields in gform_pre_render()

I have a multi page Gravity Form that presents a series of questions by way of a radio button.
Which of the following would you choose?
o Choice #1
o Choice #2
+----------+ +----------+
| BACK | | NEXT |
+----------+ +----------+
Each question and choice set is configured using custom fields (Advanced Custom Fields). I'm able to iterate through all of these questions and choices just fine from within the gform_pre_render filter and now I want to create the needed Gravity Form fields on the fly.
Specifically, there will be a page field and radio button field for every question.
I really have tried just about every search criteria I can think of on Google and scoured through documentation on Gravity Help, but I just don't see an example of adding fields dynamically.
Can someone shine a light for me? :P
You can create a field with GFFields::create(). Here's a rough example (assumes you are within the gform_pre_render filter.
$props = array(
'id' => 123,
'label' => 'My Field Label',
'type' => 'text'
);
$field = GF_Fields::create( $props );
array_push( $form['fields'], $field );
There are probably more properties you will need to specify to get the field working. I would recommend using print_r() on an existing field to get an idea of all the properties available. You will also want to make sure your field IDs are unique.
Lastly, in order for data to be captured from these existing fields, you will probably want to also add your dynamic fields via the gform_pre_validation filter as well.

Add a non database attribute to order email

we have a single attribute which is shown on single product page. Attribut Name is lieferkW. For any order of a product i want to send the content of this attribute to our customers in the order email.
i dont want to save the content of this attribute in database. Do you have any solution for my problem?
You can use other resources, like the session, the local storage, or a temporary file.
However, I would suggest that you should store this in the database and remove it when you send the email. You could have a table like this
temporary_attributes(id, userId, attribute, orderId)
insert it when you need it and remove it once you have sent the email.
To include your custom attribute lieferkW in your sales order email, make these changes
1) Open \app\code\core\Mage\Sales\Model\Order.php
$customAttr = 'custom_value'; // the attribute "lieferkW" value
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml,
'custom' => $customAttr //your custom value here
)
);
2) Now change the email template located at \app\locale\en_US\template\email\sales\order_new.html
You can access you variable here like
{{var custom}}
P.S. I advice not to make changes in the core files.

How to add additional grouped address to edit and detail view?

SugarCRM 6.5 has built in grouped address fields in the Lead Module for the Primary Address and for the Alternate Address that can be used with the Edid and Detail view. I have been able to add the fields for a third address, but when I add the new address field to the edit view and detail view, it does not show the grouped fields, just a single field.
According to the documentation I can use the customCode option in the Detail View and Edit View definitions, but I have not been able to succesfully get this working. Does anyone have any suggestions on how to accomplish this?
You must give a prefix for all the address fields like 'billing' or 'primary'. Then your address fields would be of the form:
billing_address_street
billing_address_city
billing_address_state
billing_address_postalcode
billing_address_country
In Editview you can show this as a single grouped address by adding the below code in editviewdefs. Replace 'billing' by whatever prefix you have used.
array (
'name' => 'billing_address_street',
'hideLabel' => true,
'type' => 'address',
'displayParams' =>
array (
'key' => 'billing',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
If you have a custom address field that has been added through studio, then sugarcrm won't automatically group the address fields, because the field names end in _c. This is a reported bug: https://web.sugarcrm.com/support/issues/cbb00e33-351b-5448-2e5f-4eaf7551f347
There is a blog post here explaining how to work around it:
http://www.profilingsolutions.com/archive/custom-address-fields/
(basically - remove the _c suffix from the created address fields in the database and fix up the vardefs).

Zend Form Select, managing it using the array notation

I've a form in Zend that I use to manage the privileges of a series of resources (we're talking about dynamic ACLs stored in a db). So, for each of them I want to decide, through a select element (dropdown) who has the access. The controller will receive the request and handle it. My question is: how can I do to add elements to the form for having the possibility to store all the choices in one single array composed by many elements as the number of select element of form? Can I ask you a short real example? Thank you!
$myArray = array( ''=>'Select',
'Father'=>'Father',
'Mother'=>'Mother',
'Brother'=>'Brother',
'Sister'=>'Sister',
'Daughter'=>'Daughter',
'Son'=>'Son',
'Other'=>'Other',
);
'relationship' => array(
'type'=>'select',
'options'=>
array(
'label'=>'Relation',
'multiOptions' => $myArray,
)
),
OR
check this