function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

newline's in textarea data type

I have been working with a script that pulls some product information for use in our external website.  There is a chron job that replicates the product object each night to get the latest edits for varrious product descriptions.  While I can get the data over easily enough, I am loosing formatting on some of our textarea datatypes.




--> ID (primary key)

--> Name (text)

--> Description (textarea)


Inside the Description field you might have data like:

Feature #1

Feature #2

Feature #3


What seems to come over when I call $response = $connection->query(($query), $queryOptions) is:

Feature #1Feature #2Feature #3


Here is the output of the SOAP call on a particular record, I have highlighted in red where there should be newline indications of some sort.  

[1] => SObject Object
[type] => Product2
[fields] => stdClass Object
[Name] => Managing Information Technology (IT) Projects
[ProductCode] => BU405
[Description] =>
[IsActive] => false
[CreatedDate] => 2010-01-29T04:16:01.000Z
[CreatedById] => 005A0000000WzSdIAK
[LastModifiedDate] => 2010-01-29T04:52:33.000Z
[LastModifiedById] => 005A0000000WzSdIAK
[SystemModstamp] => 2010-01-29T04:52:33.000Z
[Family] =>
[IsDeleted] => false
[Book_Cost__c] => 225.0
[Category__c] => Project Management
[Course_ID18__c] => 01tA0000000Tv0SIAS
[Description__c] => This 3-day course provides an overview of how project management concepts and principles are applied in an I.T. environment, using lecture, small group activities, and discussions. The course allows each team to follow an I.T. project from design to completion, emulating the project management life cycle.
[Display_On_Web__c] => true
[Duration__c] => 3.0
[End_Time__c] => 5:00
[Key_Topics__c] => The Project Management Framework - as described in PMI's current PMBOK guide The 9 Knowledge Areas, the 5 Process Groups, and the Iterative Process Model - processes involved in project management Key Stakeholders - their impact on, as well as their roles in, a typical project Types of Organizational Structures - their impact on managing projects Project Quality and Risk - how to account for project quality and risk as a part of the project plan Integrating Project Management with I.T. Methodology - how to incorporate I.T. application development methodologies with proven project management techniques to create practical procedures for a project management process Conducting Requirements Gathering and Analysis - how to gather and prioritize user requirements to develop an effective technology solution
[Max_Students__c] => 12.0
[Notes__c] => This course is worth 21 PDU's.
[Objectives__c] => The knowledge of how to define the role of the project manager while balancing the expectations of the different project stakeholders The ability to apply different project life cycles to manage the project based on degree of project complexity, team structure, and risk requirements The use of an integrated case study to create each of the following project deliverables: Project charter, scope statement, work breakdown structure, project network diagram, time-driven schedule, and technical requirements The ability to design and conduct a requirements gathering and analysis process, engaging key stakeholders, to determine the key success factors for the I.T. project
[On_Site_Rate__c] => 4000.0
[Public_Fee__c] => 1495.0
[Required_Skills_Experience__c] =>
[Start_Time__c] => 9:00
[Status__c] => Tentative
[Sub_category__c] =>
[Suggested_Next_Courses__c] =>
[Target_Audience__c] => The course is primarily designed for people who have or will be assigned project management responsibilities for information technology projects; for project managers, team leaders, anyone performing in those roles or soon to be performing in those roles
[VantiveID__c] => 1283.0

[Id] => 01tA0000000Tv0SIAS

I would happily make a nl2br() call once the records got too me, but the PHP tookkit seems to be stripping the newline information out before I get it.


Is there a way to make an API call using the PHPToolkit that preserves newline information for textarea datatypes?


Here is the code I am using, it's pretty much straight from the samples area...


<?php // SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL // $USERNAME - variable that contains your username (must be in the form of an email) // $PASSWORD - variable that contains your password define("SOAP_CLIENT_BASEDIR", "../includes/soapclient"); require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php'); require_once ('../userAuth.php'); try { $mySforceConnection = new SforcePartnerClient(); $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml'); $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD); $query = 'Select ID,NAME,PRODUCTCODE,DESCRIPTION,ISACTIVE,CREATEDDATE,CREATEDBYID,LASTMODIFIEDDATE,





VANTIVEID__C FROM product2 where Display_On_Web__C=true';


$response = $mySforceConnection->query(($query)); foreach ($response->records as $record) { echo '<pre>' . print_r($response, true) . '</pre>'; } } catch (Exception $e) { echo $e->faultstring; } ?>




Message Edited by bstripp on 03-27-2010 08:26 PM

Just a thought, but sometimes print_r gives funky output with stuff like this - maybe it's there and not showing up in the print_r. Have you tried just printing the output of the field itself? Either w/pre tags or with nl2br?




Well I have tried everything I could think of, including rewriting parts of the PHP toolkit to add in the nl2br function.  As far as I can tell, it doesn't pass what so ever.


Could this be a SOAP thing?


I've found the same issue using PHP Toolkit 20.0 and API 21 (using the Partner WSDL).


Newline characters appear to be stripped out and are definitely missing and it's not an issue of print_r or similar functions not displaying them. I did a character by character iteration through a string and the newline characters were just missing.


Is anyone else having this issue? Has anyone found a solution?