• dburniston
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I'm using a php script to pull data from Salesforce to put it on a Wordpress page. The script seems to run fine when the actual page is displayed and I get the relevant data from Salesforce.

When I try to edit the page again in the Wordpress backend, I get an error and can't edit the page.

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'enterprise-wsdl.xml' : failed to load external entity "enterprise-wsdl.xml" in /home2/xxxx/public_html/soapclient/SforceBaseClient.php:64 Stack trace: #0 /home2/xxxx/public_html/soapclient/SforceBaseClient.php(64): SoapClient->SoapClient('enterprise-wsdl...', Array) #1 /home2/xxxx/public_html/soapclient/SforceBaseClient.php(128): SforceBaseClient->getSoapClient('enterprise-wsdl...', Array) #2 /home2/xxxx/test/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(45) : eval()'d code(28): SforceBaseClient->createConnection('enterprise-wsdl...') #3 /home2/xxxx/test/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(45): eval() #4 /home2/xxxx/test/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcode.class.php(287): WINP_SnippetShortcodePhp->html(Array, '') #5 /home2/xxxx/test/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcodes.php(97): Wbcr_FactoryShortcodes325_S in /home2/xxxx/public_html/soapclient/SforceBaseClient.php on line 64

The enterprise-wsdl.xml file is in the public-html folder (/home2/xxxx/public_html). Wordpress is running from the public-html folder. How can I make sure that SFBaseClient.php always gets the correct path to the WSDL? It works ok when the webpage that includes my script runs, just fails in the admin backend.

Thanks,

...Dave

 
I have a custom Object to track registrations against an Opportunity in Salesforce. I created a script so that clicking a button would change the stage of the Opportunity and then go through each Registration and change the status if it was Pending.
When I test it on an Opportunity with 3 registrations, it seems to work every time. When I use it on an Opportunity with 7 registrations, it is changing registrations that it shouldn't be.
I store the conditions back to the Registration and it looks as though it should be ignoring the record, but it gets updated.
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //Required for SalesForce connection 

//Make sure not entering by mistake 
input_box = confirm ("Are you sure you want to update the workshop to Attended?") 

if (input_box==true) 

{ 
 var url = parent.location.href; //string for the URL of the current page 
 //Set up the connection and grab the current Opportunity ID 
 var conn; 
 conn = sforce.connection; 
 var opp = "{!Opportunity.Id}"; 
 var oppname= "{!Opportunity.Name}"; 

 //Get the Registration ID's for all Registrants to this Opportunity 
 var qr = conn.query("Select Registration__c.Id, Registration__c.Workshop_Cancelled__c, Registration__c.Payment_Status__c, Registration__c.Name from Registration__c where Opportunity_del__c ='" + opp + "'" ); 

 var reg = [ ]; 
 var rstat = [ ]; 
 var pstat = [ ]; 
 var paystat1 = "ignore"; // set the default action for payment status 
 var regstat1 = "ignore"; // set the default action for registration status 



 //Figure out how many Registrations there are 
 var records = qr.getArray("records"); 
 var length = records.length 

 //Build an array of registration ID's and status 
 for (var i = 0;i<length;i++) { 
 reg[i] = records[i].get("Id"); 
 rstat[i] = records[i].get("Workshop_Cancelled__c"); 
 } 

 //Build a message to display the Id's 
 //var message = "The Reg's for Opportunity " + opp + " are: "; 

 //for (var i = 0;i<length;i++) { 
 //message = message + " " + reg[i] + " " + rstat[i]; 
 //} 

 //Display the message 
 //alert(message); 

 //Update the Stage of the Opportunity to show Closed - Won 
 var _Opportunity = new sforce.SObject("Opportunity"); //create an sObject for an object - here we are using opportunity but it could be anything 
 _Opportunity.Id = opp; //id should be gathered from a query or something earlier in the script - you'll need the id of the record you want to update though 
 _Opportunity.StageName = "Closed Won"; //you can hard code a value or pass something dynamically (can be any field) - here we are hard coding an update to the opportunity stage 
 var updateOpportunity= sforce.connection.update([_Opportunity]); //actually perform the update to the record 

 //check for success 
 if (updateOpportunity[0].getBoolean("success")) { //check that the update was successful 
 alert("Updated account: "+updateOpportunity[0].id); //alert success notification 
 } else { //otherwise unsuccessful 
 alert("API error: "+updateOpportunity[0]); //alert response from update attempt 
 } 

 if (length > 0) { 
 //Update each of the registrations to update Pending to Attended and ignore the other statuses 
 var _Registration = new sforce.SObject("Registration__c"); //create an sObject for an object - here we are using opportunity but it could be anything 
 var regstat; 

 for (var i = 0;i<length;i++) {//process each registration 
 // get the values from the current registration record 
 _Registration.Id = reg[i]; // get the record id for the update 

 //regstat = rstat[i]; // get the value of Registration status for the current registration 
 _Registration.regstat__c = rstat[i]; // store the initial registration status for update to track what happened 

 regstat1 = "ignore"; // reset the default action each pass 

 //Build a message to display the Id's 
 //var message = "The values for the reg are: \n"; 
 //message = message + " " + reg[i] + " " + rstat[i] + "\n"; 
 //Display the message 
 //alert(message); 

 if (rstat[i] == "Pending"){ // If the registration status is Pending , set to process 
 regstat1 = "process"; 
 _Registration.Workshop_Cancelled__c="Attended"; 
 } 
 _Registration.regstat1__c = regstat1; // Update the holder to show value after test 

 var updateRegistration= sforce.connection.update([_Registration]); //actually perform the update to the record 
 } 

 //check for success 
 if (updateRegistration[0].getBoolean("success")) { //check that the update was successful 
 alert("Updated registration: "+updateRegistration[0].id); //alert success notification 
 } else { //otherwise unsuccessful 
 alert("API error: "+updateRegistration[0]); //alert response from update attempt 
 } 
 } 
 alert("The process has completed"); 
 parent.location.href = url; //refresh the page 
}

If the Registration status is Pending, it should be changed to Attended. There is one registration in the 7 that has a status of Cancelled. The values that get stored back show that it should be ignored, but it is being changed to Attended.

Note... the registration status field is Workshop_Cancelled__c

I also wondered if there is a way to put this in an array and then post all seven updates back at once, as I believe I am handling them one at a time... could this be part of the problem?

Thanks,

...Dave






I need to export training history from our former database and move it to Salesforce. We would then need to associate each record with a Contact. My plan was to create a Training History tab to manage this.
 
Is it possible to then have the data tied to a Contact show up in the Contact tab as a related list so our Sales Rep can see their history as part of the Contact record?
Can the Excel Connector be used to take a list of email addresses that our newsletter system says have opted out, search for the address in Salesforce Contacts and then update the Opt-Out flag if it is found?
 
Or is there another way to do this?
 
...Dave
I have a custom Object to track registrations against an Opportunity in Salesforce. I created a script so that clicking a button would change the stage of the Opportunity and then go through each Registration and change the status if it was Pending.
When I test it on an Opportunity with 3 registrations, it seems to work every time. When I use it on an Opportunity with 7 registrations, it is changing registrations that it shouldn't be.
I store the conditions back to the Registration and it looks as though it should be ignoring the record, but it gets updated.
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //Required for SalesForce connection 

//Make sure not entering by mistake 
input_box = confirm ("Are you sure you want to update the workshop to Attended?") 

if (input_box==true) 

{ 
 var url = parent.location.href; //string for the URL of the current page 
 //Set up the connection and grab the current Opportunity ID 
 var conn; 
 conn = sforce.connection; 
 var opp = "{!Opportunity.Id}"; 
 var oppname= "{!Opportunity.Name}"; 

 //Get the Registration ID's for all Registrants to this Opportunity 
 var qr = conn.query("Select Registration__c.Id, Registration__c.Workshop_Cancelled__c, Registration__c.Payment_Status__c, Registration__c.Name from Registration__c where Opportunity_del__c ='" + opp + "'" ); 

 var reg = [ ]; 
 var rstat = [ ]; 
 var pstat = [ ]; 
 var paystat1 = "ignore"; // set the default action for payment status 
 var regstat1 = "ignore"; // set the default action for registration status 



 //Figure out how many Registrations there are 
 var records = qr.getArray("records"); 
 var length = records.length 

 //Build an array of registration ID's and status 
 for (var i = 0;i<length;i++) { 
 reg[i] = records[i].get("Id"); 
 rstat[i] = records[i].get("Workshop_Cancelled__c"); 
 } 

 //Build a message to display the Id's 
 //var message = "The Reg's for Opportunity " + opp + " are: "; 

 //for (var i = 0;i<length;i++) { 
 //message = message + " " + reg[i] + " " + rstat[i]; 
 //} 

 //Display the message 
 //alert(message); 

 //Update the Stage of the Opportunity to show Closed - Won 
 var _Opportunity = new sforce.SObject("Opportunity"); //create an sObject for an object - here we are using opportunity but it could be anything 
 _Opportunity.Id = opp; //id should be gathered from a query or something earlier in the script - you'll need the id of the record you want to update though 
 _Opportunity.StageName = "Closed Won"; //you can hard code a value or pass something dynamically (can be any field) - here we are hard coding an update to the opportunity stage 
 var updateOpportunity= sforce.connection.update([_Opportunity]); //actually perform the update to the record 

 //check for success 
 if (updateOpportunity[0].getBoolean("success")) { //check that the update was successful 
 alert("Updated account: "+updateOpportunity[0].id); //alert success notification 
 } else { //otherwise unsuccessful 
 alert("API error: "+updateOpportunity[0]); //alert response from update attempt 
 } 

 if (length > 0) { 
 //Update each of the registrations to update Pending to Attended and ignore the other statuses 
 var _Registration = new sforce.SObject("Registration__c"); //create an sObject for an object - here we are using opportunity but it could be anything 
 var regstat; 

 for (var i = 0;i<length;i++) {//process each registration 
 // get the values from the current registration record 
 _Registration.Id = reg[i]; // get the record id for the update 

 //regstat = rstat[i]; // get the value of Registration status for the current registration 
 _Registration.regstat__c = rstat[i]; // store the initial registration status for update to track what happened 

 regstat1 = "ignore"; // reset the default action each pass 

 //Build a message to display the Id's 
 //var message = "The values for the reg are: \n"; 
 //message = message + " " + reg[i] + " " + rstat[i] + "\n"; 
 //Display the message 
 //alert(message); 

 if (rstat[i] == "Pending"){ // If the registration status is Pending , set to process 
 regstat1 = "process"; 
 _Registration.Workshop_Cancelled__c="Attended"; 
 } 
 _Registration.regstat1__c = regstat1; // Update the holder to show value after test 

 var updateRegistration= sforce.connection.update([_Registration]); //actually perform the update to the record 
 } 

 //check for success 
 if (updateRegistration[0].getBoolean("success")) { //check that the update was successful 
 alert("Updated registration: "+updateRegistration[0].id); //alert success notification 
 } else { //otherwise unsuccessful 
 alert("API error: "+updateRegistration[0]); //alert response from update attempt 
 } 
 } 
 alert("The process has completed"); 
 parent.location.href = url; //refresh the page 
}

If the Registration status is Pending, it should be changed to Attended. There is one registration in the 7 that has a status of Cancelled. The values that get stored back show that it should be ignored, but it is being changed to Attended.

Note... the registration status field is Workshop_Cancelled__c

I also wondered if there is a way to put this in an array and then post all seven updates back at once, as I believe I am handling them one at a time... could this be part of the problem?

Thanks,

...Dave






Can the Excel Connector be used to take a list of email addresses that our newsletter system says have opted out, search for the address in Salesforce Contacts and then update the Opt-Out flag if it is found?
 
Or is there another way to do this?
 
...Dave