Accessing a Custom Field when creating a Task with Zoho Projects API

Accessing a Custom Field when creating a Task with Zoho Projects API

We've created a custom field called Target Date through the Zoho Projects Portal, and are now trying to access that field with information I'm passing to it. 

First we thought just formatting it as a JSON string by hand would work, but it didn't so we looked into the structure more.
When we get the project details of a task that already includes a Task Date, we get this structure:
  1.   'custom_fields' => 
        array (size=1)
          0 => 
            array (size=3)
              'column_name' => string 'UDF_DATE2' (length=9)
              'label_name' => string 'Target Date' (length=11)
              'value' => string '10-11-2019 08:00:00 AM' (length=22)
The example says to use UDF_CHAR1, so we tried that as well as the column_name attribute. We also tried naming the values of the array to what they should be, and conceivable different ways of formatting it.

This is the closest we've got, it doesn't add the Target Date but it at least doesn't break the rest of the task creation. 

  1. $targetDate = [
                                'UDF_DATE2'=>'10-17-2021 08:00:00 AM',
                            ];
  2.                         $result = $ZohoProject->createTask([
                                    'name'=>$FeeBreakdownRow->Title,
                                    'tasklist_id'=>$Parent->ZohoID,
                                    'duration'=>$FeeBreakdownRow->Hours,
                                    'description'=>$FeeBreakdownRow->Description,
                                    'start_date'=>date('m-d-Y'),
                                    'custom_fields[]' => json_include($targetDate),
                                    'duration_type'=>'hrs',
                                    'work_type'=>'work_hours',
                                    'task_duration_as_work'=>'true',
                                    'person_responsible'=>$ZohoProject->findUserIDFromEmail($FeeBreakdownRow->OwnerEmail),
                                ]);
      And createTask:
  1.           public function createTask($params=[],$projectID=''){   
            $projectID  = ($projectID)?$projectID:$this->projectID
            $default_params = array(
                'priority'=>'None',
                'authtoken'=>self::AuthToken(),
            );
            $url = self::BASE_URL.'/portal/'.$this->portalID.'/projects/'.$projectID.'/tasks/';
            //var_dump($params);
            return $this->parseResponse($this->doRequest($url,array_replace($default_params,$params),'POST'));
        }

If there was an example that used a date I'm sure I could figure out how it works, but right now I feel like we've guessed everything it can possibly be and haven't had any luck yet. An example, or some pointers on what I'm doing wrong would be very helpful. Thanks!

    • Sticky Posts

    • Announcing the Zoho Projects API

      Today we're excited to announce the API for Zoho Projects where any developer can extend the project management and collaboration capabilities through our APIs and can build their own customized applications for their business needs. We've tried to make the API follow the REST (Representational State Transfer) principles and generate a XML/ JSON object which allows you to access / read / write Zoho Projects data from third-party systems like Google/Yahoo gadgets, web sites, billing & invoicing systems,
    • Have you moved to REST API?

      Dear API Users, The Documentation of our Rest API is available here . All future development will be done to this version. We are deprecating the older API today. Its documentation will no longer be available and we will also be stopping the calls to this API soon. Thanks, Prasanna


          Zoho TeamInbox Resources

            Zoho DataPrep Resources


                Zoho CRM Plus Resources

                  Zoho Books Resources


                    Zoho Subscriptions Resources

                      Zoho Desk Resources

                        Zoho Projects Resources


                          Zoho Sprints Resources


                            Zoho Orchestly Resources


                              Zoho Creator Resources


                                Zoho WorkDrive Resources




                                    Zoho Campaigns Resources

                                      Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方