Reputation: 562
Another framework studying today and just started about 4 days now. My goal is to add a new button in the detail view with function, specifically in Contacts module. I added a new field called "active_c" which is a check box. If the checkbox is check then he clicks the button the field then is unchecked, which mean the contact is inactive.
I have done the new button part and I already found where to put my code upon clicking the button (it is on the module controller right?). What I am lacking is to update the record to check or uncheck, or true or false, or 1 or 0.
I have found some using soap but it does not work for me. Heres a part of my code.
$client = new nusoapclient('http://localhost/sugarcrm/soap.php?wsdl',true);
//login
$auth_array = array(
'user_name' => $current_user->user_name,
'password' => $current_user->user_hash,
'version' => '6.5.2'
);
$session = $client->call('login',array('user_auth'=>$auth_array,
'application_name'=>'SugarCRM'));
$session_id = $session['id'];
My "$session" retruns nothing if I printed it out. Without session['id'] I cannot proceed to *set_entry*.
I'm using only localhost.
Help, How do I do this guys?
Regards, Ronel C.
Upvotes: 1
Views: 1125
Reputation: 562
Thanks for the reply guys. My intention really was, is to update a record everytime the button is clicked and I found the answer. So stupid of me to go into much complex way.
What I did was (in case somebody else has problem):
//Instantiate the class - for me its Contacts
$contact = new Contact();
// Use retrive
$data = $contact->retrieve($record_id);
$data->first_name = 'Pedro Penduko';
$data->save($record_id);
And thats it.
Upvotes: 1
Reputation: 2208
You should not be using the older soap.php entrypoint, but the newer services/ one as the older is deprecated and will be removed in a future release.
http://developers.sugarcrm.com/wordpress/2010/11/11/web-services-in-your-own-language-part-1-php-2/
Upvotes: 0
Reputation: 576
Could you test with 127.0.0.1
in your URL instead of localhost like http://127.0.0.1/sugarcrm/soap.php?wsdl
Upvotes: 0