• bstripp
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

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.

 

Example:

product

--> 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 Salesforce.com username (must be in the form of an email) // $PASSWORD - variable that contains your Salesforce.com 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,

LASTMODIFIEDBYID,SYSTEMMODSTAMP,FAMILY,ISDELETED,BOOK_COST__C,CATEGORY__C,COURSE_ID18__C,

DESCRIPTION__C,DISPLAY_ON_WEB__C,DURATION__C,END_TIME__C,KEY_TOPICS__C,MAX_STUDENTS__C,

NOTES__C,OBJECTIVES__C,ON_SITE_RATE__C,PUBLIC_FEE__C,REQUIRED_SKILLS_EXPERIENCE__C,

START_TIME__C,STATUS__C,SUB_CATEGORY__C,SUGGESTED_NEXT_COURSES__C,TARGET_AUDIENCE__C,

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

So I have two custom objects, class and location with the relation class --> location.

 

When I make my call I use the following:

 

Select c.Location__r.Name, c.Course_Name__c From Class__c c

 

It works fine, but I am noticing that the relationship seems to be returning an array.  I'm not familiar enough with Eclipse to verify this, but since you have to click on the relationship to see the data that was my guess.

 

I have two questions on the process:

(1) Should I tell my PHP script to expect an array?  Or since I know it's going to be one value in all cases, can I just call it a varriable of the correct type?

 

(2) Is there any way to do a more traditional join?

 

Thanks all!

Hello,

 

I am quite new to this platform and can see there is a lot to get to grips with.  I am looking for a general overview of which of the varrious technologies I should be focusing to do the following:

 

(1) We are going to be using Sales Force just for our interal staff

(2) We have an existing website that we need to export schedule data for our training classes

(3) I need to get that data to display real time on our existing web site

 

I assume that I am going to be using AJAX?  Is that where I should start reading to get a handle on how to make those calls from our existing site?

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.

 

Example:

product

--> 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 Salesforce.com username (must be in the form of an email) // $PASSWORD - variable that contains your Salesforce.com 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,

LASTMODIFIEDBYID,SYSTEMMODSTAMP,FAMILY,ISDELETED,BOOK_COST__C,CATEGORY__C,COURSE_ID18__C,

DESCRIPTION__C,DISPLAY_ON_WEB__C,DURATION__C,END_TIME__C,KEY_TOPICS__C,MAX_STUDENTS__C,

NOTES__C,OBJECTIVES__C,ON_SITE_RATE__C,PUBLIC_FEE__C,REQUIRED_SKILLS_EXPERIENCE__C,

START_TIME__C,STATUS__C,SUB_CATEGORY__C,SUGGESTED_NEXT_COURSES__C,TARGET_AUDIENCE__C,

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