Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Angel

Thread: Código para crear caso

  1. #1
    rserra is offline Sugar Community Member
    Join Date
    Oct 2011
    Posts
    22

    Default Código para crear caso

    Saludos a todos,

    Alguien me puede decir el código php para crear un caso invocándolo desde un servicio web externo a Sugar,
    Para crear un Lead sería algo así:

    PHP Code:
    <?php
    define
    ('sugarEntry'TRUE);
    //Use the NuSOAP files
    require_once('nusoap/nusoap.php');
    // change the URL here to point to your Sugar installation
    $soapclient = new nusoapclient('http://www.example.com/sugar/soap.php?wsdl',true);
    // change the user credentials below to be a valid user id and password for the Sugar
    // installation defined above
    $user_auth = array(
    'user_auth' => array(
    'user_name' => 'bob',
    'password' => md5('mysecretpassword'),
    'version' => '0.1'
    ),
    'application_name' => 'soapleadcapture'); 
     
    $result_array $soapclient->call('login',$user_auth);
    $session_id $result_array['id'];
     
    $user_guid $soapclient->call('get_user_id',$session_id);
    // Up until now, we have not introduced anything new
    // The following lines will use the set_entry SOAP call to add
    // a Lead from a mixture of POST variables and hard coded
    // values, then assign to the authenticated Sugar user...
    $set_entry_params = array(
    'session' => $session_id,
    'module_name' => 'Leads',
    'name_value_list'=>array(
    array(
    'name'=>'first_name','value'=>$_POST['first_name']),
    array(
    'name'=>'last_name','value'=>$_POST['last_name']),
    array(
    'name'=>'status''value'=>'New'),
    array(
    'name'=>'phone_work''value'=>$_POST['phone']),
    array(
    'name'=>'phone_fax''value'=>$_POST['fax']),
    array(
    'name'=>'account_name','value'=>$_POST['companyname']),
    array(
    'name'=>'lead_source','value'=>'Web Site'),
    array(
    'name'=>'description','value'=>$_POST['prod_desc']),
    array(
    'name'=>'assigned_user_id''value'=>$user_guid)));
     
    $result $soapclient->call('set_entry',$set_entry_params);
    // this redirects to a page specified in the previous page...
    header("Location: " $_POST['redirect']);
    ?>
    y quisiera saber como para crear el caso, aparte de los datos de conexión.

    Gracias.

    Ramón.

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Código para crear caso

    Pudiera usar este mismo codigo con unos cambios..

    Para empezar, cambie

    Code:
    'module_name' => 'Leads'
    a

    Code:
    'module_name' => 'Cases'
    Luego, esta parte...

    Code:
    'name_value_list'=>array( 
    array('name'=>'first_name','value'=>$_POST['first_name']), 
    array('name'=>'last_name','value'=>$_POST['last_name']), 
    array('name'=>'status', 'value'=>'New'), 
    array('name'=>'phone_work', 'value'=>$_POST['phone']), 
    array('name'=>'phone_fax', 'value'=>$_POST['fax']), 
    array('name'=>'account_name','value'=>$_POST['companyname']), 
    array('name'=>'lead_source','value'=>'Web Site'), 
    array('name'=>'description','value'=>$_POST['prod_desc']), 
    array('name'=>'assigned_user_id', 'value'=>$user_guid)));
    ..la tiene que actualizar para cambiarle los nombres de los campos para que coincidan con los nombres de los campos en el modulo de casos y ya estubo. El resto es igual.
    hdanielb likes this.
    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)
    ______________________________________________

  3. #3
    rserra is offline Sugar Community Member
    Join Date
    Oct 2011
    Posts
    22

    Default Re: Código para crear caso

    OK gracias por la respuesta,

    Donde puedo saber los campos de un caso?

    Ramón

  4. #4
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Código para crear caso

    La manera mas facil seria revisando la tabla cases en la base de datos, tambien revisando modules/Cases/Case.php
    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)
    ______________________________________________

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Campo custom com código em Subpanel
    By Tedric in forum Portugese
    Replies: 2
    Last Post: 2009-12-15, 03:14 PM
  2. Problemas para crear Dropdown lists
    By amoreno21 in forum Español
    Replies: 4
    Last Post: 2008-04-10, 02:13 AM
  3. Paos para crear un modulo nuevo
    By rivaldes in forum Español
    Replies: 0
    Last Post: 2007-08-09, 05:52 PM
  4. caso de uso?
    By polles in forum Español
    Replies: 1
    Last Post: 2007-07-21, 02:46 AM
  5. Replies: 1
    Last Post: 2007-05-25, 04:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •