Results 1 to 5 of 5

Thread: Creating Tasks Via Soap web services : Problems with dates

  1. #1
    kellyjra is offline Junior Member
    Join Date
    Mar 2009
    Posts
    3

    Default Creating Tasks Via Soap web services : Problems with dates

    Apache Version : 2.2.11
    MySQL Version : 5.1.30
    OS : MS Windows Server 2003 Standard Edition Service Pack 2
    PHP : 5.2.8 + PEAR
    Sugar Version : 5.2.0a (Build 5447)
    Category : Tasks

    Hi Folks,
    newbie to this forum and also to Sugar. I am in the process of integrating my application with SugarCRM. I have written a custom PHP script that accepts a HTTP Request and then creates a Task in Sugar using the Soap functionality. The HTTP Request is being submitted by a Java class, and I am encoding the request before it is sent (UTF-8 encoding).

    I am passing a "start date" and a "due date" in the HTTP request. The format of dates I am passing in to the Task create is "mm/dd/yyyy". In the name->value list I am taking these values from the HTTP request and assigned the values to the names "date_start" and "date_due" respectively. I have included a copy of the PHP script below.

    When I submit a HTTP request to my script, the script executes and a Task is successfully created. However, when the Task is created and I go view it in the Task List in Sugar, the Start Date and the Due Date for the task are both blank. All the other data I am sending is working fine (including two custom fields i have added myself). I need the date fields to be populated because I need to be able to filter the Tasks view on the value of the dates.

    Is there something wrong with this format? Or is there another reason why the dates I am passing in is not being displayed when I view the Tasks in Sugar?

    Hopefully one of you folks can help me out on this, I would be extremely grateful.

    Many thanks.

    PHP Code:
    <?php
      
    if(!defined('sugarEntry'))define('sugarEntry'true);
      require_once(
    'include/nusoap/nusoap.php');

      
    $soapclient = new nusoapclient('http://localhost/SugarCE/soap.php?wsdl',true);

     
    $user_auth = array(
                     
    'user_auth' => array(
                           
    'user_name' => 'admin',
                           
    'password' => md5('##########'),
                           
    'version' => '0.1'
                           
    ),
                     
    'application_name' => 'soaptaskcapture');


     
    $result_array $soapclient->call('login',$user_auth);

     
    $session_id =  $result_array['id'];

     
    $user_guid $soapclient->call('get_user_id',$session_id);

     echo(
    "date_due" $_POST['date_due']);
     echo(
    "date_start" $_POST['date_start']);

     
    // The following lines will use the set_entry SOAP call to add
     // values, then assign to the authenticated Sugar user...
     
    $set_entry_params = array(
                           
    'session' => $session_id,
                           
    'module_name' => 'Tasks',
                           
    'name_value_list'=>array(
                               array(
    'name'=>'name','value'=>$_POST['name']),
                               array(
    'name'=>'status','value'=>$_POST['status']),
                               array(
    'name'=>'priority''value'=>$_POST['priority']),
                               array(
    'name'=>'description','value'=>$_POST['description']),
                               array(
    'name'=>'date_due','value'=>$_POST['date_due']),
                               array(
    'name'=>'date_start','value'=>$_POST['date_start']),
                               array(
    'name'=>'cif_c','value'=>$_POST['cif_c']),
                               array(
    'name'=>'member_rep_c','value'=>$_POST['member_rep_c']),
                               array(
    'name'=>'assigned_user_id''value'=>$user_guid)));

     
    $result $soapclient->call('set_entry',$set_entry_params);
     
    ?>

  2. #2
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Creating Tasks Via Soap web services : Problems with dates

    Pass the date in the format specified in user preferences.

  3. #3
    kellyjra is offline Junior Member
    Join Date
    Mar 2009
    Posts
    3

    Default Re: Creating Tasks Via Soap web services : Problems with dates

    Hi CRMSiva,
    many thanks for your quick response. I have checked the "MyAccount" section in Sugar for the user in question ("admin"). Under the heading "Locale", the date format is the following;

    Locale Settings:
    Date format: 12/23/2006


    This is the format I am using, and yet it is not working. Is this what you mean by "User Preferences"?

    Thanks.

  4. #4
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Creating Tasks Via Soap web services : Problems with dates

    i meant the same. Then try yyyy/mm/dd format. Generally date is stored in DB in yyyy/mm/dd format

  5. #5
    kellyjra is offline Junior Member
    Join Date
    Mar 2009
    Posts
    3

    Default Re: Creating Tasks Via Soap web services : Problems with dates

    you sir, are a genius! it works! Thank you very much - I can stop pulling my hair out now!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. web services using soap
    By gopalkalasa in forum General Discussion
    Replies: 0
    Last Post: 2009-01-23, 09:25 AM
  2. SOAP permissions problems when creating prospectlists
    By jussik in forum Developer Help
    Replies: 1
    Last Post: 2008-11-10, 03:09 PM
  3. Tasks dates & times
    By Triffid in forum Help
    Replies: 2
    Last Post: 2007-10-07, 07:58 PM
  4. Help w/Soap Services And PHP
    By hopelab in forum Developer Help
    Replies: 2
    Last Post: 2006-03-23, 02:41 AM
  5. SOAP Services
    By Loerincz in forum Developer Help
    Replies: 5
    Last Post: 2006-03-03, 08:59 PM

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
  •