hello friends, now my sugar is starting to like to mehaha
I have other issue, I will try to explain it at the next image at the best way:
NOTE:The fields of the second module are of kind related to contacts
hello friends, now my sugar is starting to like to mehaha
I have other issue, I will try to explain it at the next image at the best way:
NOTE:The fields of the second module are of kind related to contacts
You can implement this code instead, so you can access the related values directaly.
CheersPHP Code:$first_module = loadBean('FirstModule');
$first_module->retrieve('first_module_id');
$this->field = $first_module->related_field;
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
Hola Daniel
Revisa esta entrada Blog
SugarCRM Developer Blog » Blog Archive » HOWTO: Using a relate field to populate a custom field
Slds
Andrew
Hola Daniel
Revisa esta entrada Blog
SugarCRM Developer Blog » Blog Archive » HOWTO: Using a relate field to populate a custom field
Slds
Andrew
I added this code firstly, and then appeared an error message that says that the function retrieve calls non a object.
So, next, I added this other, but nothing happensPHP Code:$contacts = loadBean('Contacts');
$contacts->retrieve($_REQUEST['id_contacto']);
$this->related_to_contactsr_c = $contacts->related_to_contactsr_c;
doesn't appear any error message but all continues equal
One question: I have realized that, next to create one relate field, in my table_cstm automatic have created two new fields:relatefield_id_c and relatefield_c.PHP Code:$contacts = new Contact();
$contacts = loadBean('Contacts');
$contacts->retrieve($_REQUEST['id_contacto']);
$this->related_to_contactsr_c = $contacts->related_to_contactsr_c;
But, it only inserting records in database in relatefield_id_c, not in relatefield_c. For this, I don't find the value in order to retrieve and save it
(as I do with the other fields of database, that contain the values that I need)
Last edited by garciasanchezdaniel; 2011-09-16 at 08:04 AM.
Where the value of a related field is saved in database?
Now it works, the value of the field of the first module is copied to the field of the second module,
but when I press the button save, appear: "no matches found for the field"
how can I solve this issue?
Last edited by garciasanchezdaniel; 2011-09-16 at 10:41 AM.
Solved!! The issue was that id of the relate field wasn't been copied properly...I realized using firebug,
So, the fix was add to the code:
In this way, the id of the relate field is copied, and I can save this new record withour introduce manually the relate field,PHP Code:$this->related_to_contactsr_id_c = $contacts->related_to_contactsr_id_c;
instead is copied of the first module
Thanks so much
Hello again, this question is for andopes:
is this piece of code secure? ,that is, can fail any times this code? specifically, loadBean()?
because I realized that, some times, it doesn't charge properly and then it appears a screen like this in the navigator:
(this happen with some records)
Last edited by garciasanchezdaniel; 2011-09-20 at 07:58 AM.
La verdad que nunca he usado loadBean() para poder comentar, pero si he hecho algo parecido varias veces, usando algo como esto:
Intentelo asi..Code:require_once('modules/Contacts/Contact.php'); $contact = new Contact(); $contact->retrieve($contact_id); $this->related_to_contactsr_c = $contacts->related_to_contactsr_c; $contact->save();
Regards,
Angel Magaña
Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
Blog: http://cheleguanaco.blogspot.com.
Twitter: @cheleguanaco.
________
| Projects: |_____________________________________
|
| CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
| GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
| CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
| Round Robin Leads Assignment
| Phone Number Formatter
| CaseTwit (Twitter Integration)
______________________________________________
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks