• sean_at_33050
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 10
    Replies
I understand the functionality does not exist to create or maintain picklist values with the API. Does anyone know of a workaround for this?
My situation is as follws:
We have an external data table NOT maintained through SalesForce (requirement - except for a single reference code, the data from this table can not be added to salesforce) . There is a custom object in which one of the fields is this reference code. We want a salesforce user to set this field when an instance of the custom object is created.
A pick list would be perfect here if its values could be maintained through the API. (We will not keep updating picklists manually).
I have tried a custom scontrol like:
Code:
<script language = "javascript">
<!--
      var XMLHttpRequestObject = false;

      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
      }


      function show_code_list(sfid, targetID){
        if(XMLHttpRequestObject) {
          var the_url = "https://a_real_ext_site/sf_pick_code.php";
          var args = "spid=" + sfid +"&sessionId={!API.Session_ID}&location={!API.Partner_Server_URL_90}";
          var obj = document.getElementById(targetID);
          XMLHttpRequestObject.open("POST", the_url);
          XMLHttpRequestObject.setRequestHeader('Content-Type',
            'application/x-www-form-urlencoded');

          XMLHttpRequestObject.onreadystatechange = function()
          {
            if (XMLHttpRequestObject.readyState == 4 &&
              XMLHttpRequestObject.status == 200) {
                obj.innerHTML = XMLHttpRequestObject.responseText;
            }
          }
          XMLHttpRequestObject.send(args);
        }
      }
//-->
</script>
<span id="targSpan"></span>
<script language = "javascript">
<!--
show_code_list( "{!AN_OBJ__c.SalespersonId__c}", "targSpan" );
//-->
</script>

 
This does not work as you get an access denied error because of the xmlhttprequest spanning domains.
So does anyone have any ideas on how to get external html data to appear realtime WITHIN a page?
Am I missing something? I would like to find some other method besides creating a link that opens another window?
Thanks.
Sean 
Has anyone here tried integrating Borland's StarTeam v6.0 product with SalesForce?
I am trying to display in SalesForce the various stages of software development/deployment contained within the StarTeam database (Delphi).
 
Thanks.
Since a forced change in SalesForce password, when I start eclipse I get:
INVALID_LOGIN: Invalid username or password or locked out.
 
I think because eclipse saves your login credentials somewhere. So I go into the eclipse project->properties->AppExchange and try to enter my new working Salesforce password. When I click apply or ok I get the same error message as above.
So how do I tell eclipse my new salesforce password????
 
Any ideas?
 
Thanks,
Sean
Very simple question:
I have the follwing:
Code:
$startDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 01, 2006)); 
$endDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 15, 2006)); 
echo $startDate ."<br>";
echo $endDate ."<br>";

$result = $mySforceConnection->getUpdated('Batch__c',$startDate, $endDate );
print_r( $result );

 
which produces something like this:
Code:
stdClass Object
(
    [ids] => Array
        (
            [0] => a00300000...
            [1] => a00300000....
            [2] => a003000000...

 
(the "a003000.." being real salesforce object Ids)
 
Can someone post an example PHP code segment that "gets the ids" from $result object?
 
Here's what I tried so far:
Code:
if (is_array($result)) { // <- never true—
    $resultSize = count($result);
    for ($i = 0; $i < $resultSize; $i++) {
        echo $result[$i] ."<br>";
    }
} else {
  foreach( $result->ids as $r){
    $r = new SObject($r);
    print_r( $r ); //$n = $r->ids;
    echo "<br>";
  }
}

 
Also, anyone know of any practical ("By example" type) guides for learning to use objects?
 
Thank alot.
 
Sean
Hello,
I am trying to "put" data from an Opportunity into another tab object called "Batches".
I have an example of how it was done by my organization in the past using a custom link but I am not sure if there is a better way.
Here is part of a custom link within Opportunity:
https://na1.salesforce.com/a00/e? retURL=%2F00630000001b2Sq &Name={!Opportunity_Batch_Number} &00N30000000i3EK={!Opportunity_Batch_Number} &00N30000000j5Dl={!Opportunity_Batch_Number} &CF00N30000000hK45={!Opportunity_Account_Name} &CF00N30000000gpxH={!Opportunity_Name}& ....
It looks like in order refer to fields of an object outside the current object, you have to specify their object id.
My question is what is the "a00/e" and how do you know to use it. And what is "=%2F00630000001b2Sq".
There appears to be a "CF" in front some object ids. Is this kind of usage documented anywhere?
If this is how to get and put data between objects, is there a way to get a complete report of ALL object names and IDs to make development easier? I find it hard to believe that this is the way it's done, but I'm new with SalesForce so anyhelp would be great.
Thanks.
 
 
Is this possible?
Say you have a custom tab: objects called: lots with lot_01, lot_02, etc. (Each lot object has a custom checkbox field: In_Use.) You have a custom field (lookup) in opportunities called "Space:"
Let's say you goto Oppurtunity "X" and lookup and choose "lot_01" for field "Space". Now I want to goto Oppurtunity "Y" and populate the field "Space" using the lookup feature. Since lot_01 has been used in Opportunity "X", when I select the lookup for field, I do not want "lot_01" to be a choice. Once the field "Space" on Opportunity "X" is blanked out, then lot_01 appears within the lookup list again.
(Users can be trusted to not enter junk manually into the field) 
I don't have to use Lookup list - I can go with a picklist - I just need to draw from a pool of items while preventing the same list item from existing in more than one Opportunity.
Is this possible? 
 
Thanks.
Newbie - trying to use the describe layout method from code samples found in these forums. I get the following error:
 
IVALID_TYPE sObject type cannot be null
 
The "welcome user (email)" works fine. NOTHING else is printed after the above error message. The "getlastrequest() ..." prints nothing.
Can someone point me in the right direction or at least explain how to turn on debug or XML tracing?
(using apache w SSL  2.0.59, PHP 5.1.6, using current partner wsdl from developer edition)
 
Thanks.
 
Here is the code:
 
Code:
<—php
require_once ('../soapclient/SforcePartnerClient.php');
require_once ('../soapclient/SforceHeaderOptions.php');

$mySforceConnection;
$sforceSoapClient;
$myUserInfo;
$wsdl = 'partner.wsdl.xml';
include ('header.inc');
try{
   $mySforceConnection = new SforcePartnerClient();
   $sforceSoapClient = $mySforceConnection->createConnection($wsdl);
   $loginResult = $mySforceConnection->login("myusername", "mypasswd"); /* real usr/pw here */
   $myUserInfo = $mySforceConnection->getUserInfo();
  } catch (exception $e) {
    print ('one error: ' . $e->faultstring . '<br>');
    print_r($mySforceConnection->getLastRequest());
    print_r('<br>');
    print_r($mySforceConnection->getLastRequestHeaders());
    print_r('<br>');
    print_r($mySforceConnection->getLastResponse());
    exit ();
  }
   /*  THIS WORKS */
  echo 'Welcome, ' . $myUserInfo->userFullName . "( $myUserInfo->userEmail )" . '.<br>';
 try {
    /* THIS DOES NOT */
    $describe = $sforceSoapClient->describeLayout("Opportunity");
    for($i = 0; $i < sizeof($describe->layouts); $i++) {
       print($describe->layouts[$i]->heading . "<br>");
    }
  } catch (exception $e) {
    print ('error: ' . $e->faultstring . '<br>');
    print_r($mySforceConnection->getLastRequest());
    print_r('<br>');
    print_r($mySforceConnection->getLastRequestHeaders());
    print_r('<br>');
    print_r($mySforceConnection->getLastResponse());
    exit ();
  }
include ('footer.inc');
–>

 
Since a forced change in SalesForce password, when I start eclipse I get:
INVALID_LOGIN: Invalid username or password or locked out.
 
I think because eclipse saves your login credentials somewhere. So I go into the eclipse project->properties->AppExchange and try to enter my new working Salesforce password. When I click apply or ok I get the same error message as above.
So how do I tell eclipse my new salesforce password????
 
Any ideas?
 
Thanks,
Sean
Very simple question:
I have the follwing:
Code:
$startDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 01, 2006)); 
$endDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 15, 2006)); 
echo $startDate ."<br>";
echo $endDate ."<br>";

$result = $mySforceConnection->getUpdated('Batch__c',$startDate, $endDate );
print_r( $result );

 
which produces something like this:
Code:
stdClass Object
(
    [ids] => Array
        (
            [0] => a00300000...
            [1] => a00300000....
            [2] => a003000000...

 
(the "a003000.." being real salesforce object Ids)
 
Can someone post an example PHP code segment that "gets the ids" from $result object?
 
Here's what I tried so far:
Code:
if (is_array($result)) { // <- never true—
    $resultSize = count($result);
    for ($i = 0; $i < $resultSize; $i++) {
        echo $result[$i] ."<br>";
    }
} else {
  foreach( $result->ids as $r){
    $r = new SObject($r);
    print_r( $r ); //$n = $r->ids;
    echo "<br>";
  }
}

 
Also, anyone know of any practical ("By example" type) guides for learning to use objects?
 
Thank alot.
 
Sean

Greetings folks,

I've been banging my head, searching all over SFDC user/developer sites and googled, but still can't find solution. I have read in these forums of others doing this, but they do not post the complete code of how it's done. I am xhtml/css savvy but am a total newbie at JavaScript (except cut 'n' paste) and S-Controls (this is my first attempt).


DESCRIPTION
---------------------------------------------------
This is what I am attempting to do:

[]  Create a new record of a Custom Object (Quote/Sales Order) via a custom link on Opportunities that calls an S-Control.
[]  The custom object is a related list (child) to opportunities.)
[]  When the link is clicked, the S-Control will open the input form page of a new record of the custom object with certain fields prepopulated.
[]  These fields are prepopulated with data contained in fields of the related Opportunity and Account.
[]  The input page with the prepopulated is to remain open so that the user may complete any remaining fields he/she wishes and then saves the new record.


PURPOSE
---------------------------------------------------
This custom object has fields containing the exact same data as fields in the related Opportunity and Account. Thus the purpose of the S-Control is to improve usability and data integrity by eliminating the need to force users to perform double transcription.


CODE
---------------------------------------------------
Here is the code I wrote with comments on field types and alert results. It doesn't create the new record and returns the saveAlert ID as null.


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Create Quote</title>

<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script language="javascript">
<!--
function initPage() {
sforceClient.registerInitCallback(createQuote);
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
window.setTimeout(";", 1000);
}

function createQuote() {
var quote = new Sforce.Dynabean("Quote_Sales_Order_Data__c");
alert("function initPage() and start of createQuote() running good!") // Alert displays
quote.set("Name", "{!Opportunity_Opportunity_Number}") //Standard text field - Name of custom objext - Required - Reading from Autonumber field
quote.set("Opportunity__c", "{!Opportunity_Name}") //Master-Detail relationship - Parent Opportunity - Required
quote.set("GXT_Business_Unit__c", "{!Opportunity_GXT_Business_Unit}");
quote.set("GXT_Service_Center__c", "{!Opportunity_GXT_Service_Center}");
quote.set("Submission_Date__c", new Date());
quote.set("Survey_Name_Area_Block__c", "{!Opportunity_Survey_Name_Area_Block}");
quote.set("GXT_Project_Manager__c", "{!Opportunity_GXT_Project_Manager}");
quote.set("Geographic_Region__c", "{!Opportunity_Geographic_Region}");
quote.set("Environment__c", "{!Opportunity_Environment}");
quote.set("Country__c", "{!Opportunity_Country}");
quote.set("Dimension__c", "{!Opportunity_Dimension}");
quote.set("Expected_Start_Date__c", new Date("{!Opportunity_Expected_Start_Date}"));
quote.set("Expected_Delivery_Date__c", new Date("{!Opportunity_Expected_Delivery_Date}"));
quote.set("Account__c", "{!Account_Name}");
quote.set("Billing_Address__c", "{!Account_BillingAddress}");
alert("All quote.set items completed!") // Alert displays

var saveResult = sforceClient.create([quote]);
alert("New Quote Item ID: " + saveResult[0].id); // Alert returns null

}
//-->
</script>
</head>

<body onload="initPage()">
<p>This feature is still under development and not yet implemented. Please click your browsers Back button to return to your opportunity. Sorry for the inconveniene.</p>
</body>
</html> 
---------------------------------------------------

I appreciate any guidance you can offer. My users are very annoyed at having to do double entry, causing SFDC adoption to decline significantly in my organization.


Thanks and may you have a great day, everyday!

Robert
rstallard@gxt.com

Message Edited by RLStallard-GXT on 10-19-2006 12:59 AM

Hopefully this is an easy one.  In the code below, I create a custom object (Dept) that has a one to many relationship with the contact (one Dept to many contacts).  The s-control starts from the contact and creates the new Dept with the account_id and the address information from the contact.  I use the create function on the Dynabean to create the Dept, and then retrieve the Id of the new object so I can open the record in the modal window.
 
The issue arises when I try to update the Contact record with the id of the new Dept.  I get a javascript error referencing line 3653, with the error message of "exception thrown and not caught".
 
I am pretty new to all this stuff, so I looked at the js library file for AJAX 3.3 beta and the function around line 3653 reads:
 
Sforce.Dynabean.prototype.set = function(propName, value) {
 var fldDef = this.definition.fieldMap.getItem(propName);
 var cr = this.definition.childRelationships.getItem(propName.toLowerCase());
 var rn = this.definition.parentRelationships.getItem(propName.toLowerCase());
 if (fldDef == null && cr == null && rn == null) {
  throw "The property " + propName + " is not a valid field.";
 } else {     <----- This is line 3653
  //Validate type if possible
  //TODO validate other types
  if (fldDef != null) {
   if (fldDef.type == "date" || fldDef.type == "datetime") {
    if (Sforce.Util.dltypeof(value) != "date" && Sforce.Util.dltypeof(value) != "datetime" && value != null) {
     throw "Invalid type: You passed a " + Sforce.Util.dltypeof(value) + " but the field requires a " + fldDef.type + ".";
    }
   }
  }
 
It appears that it cannot find a reference to the field I want to write back to.  The field is of type "lookup" and should reference a Dept related object.
 
Here is the section of the code where I do the update.  Thanks in advance for any help!
 
//This is where I create the new Dept
var newDeptList = new Array();

var newDept = new Sforce.Dynabean("Department__c");
newDept.set("Id","");
newDept.set("Name", name + " - " + deptPrompt );
newDept.set("Account__c", "{!Account_Id}" );
newDept.set("Legal_Entity__c", legal_entity);
newDept.set("Address__c",mailing_street);
newDept.set("City__c",mailing_city);
newDept.set("StateProvince__c",mailing_state);
newDept.set("Country__c",mailing_country);
newDept.set("Postal_Code__c",mailing_postalcode);

newDeptList[0] = newDept;

// Create new Department
results = sforceClient.Create(newDeptList);

//If the first value in the result array is null then it's a fault.

if( results[0] != null &&
results[0].success == true )
 
//Now I go to get the Id of the new dept record I created
{
// Fetch department id
newDeptId = results[0].id;


//Update the existing contact with the new Dept ID
var contactUpdateList = new Array();

var contactUpdate = new Sforce.Dynabean("contact");
contactUpdate.set("Id","{!Contact_Id}");
 
//The next line is where it fails
contactUpdate.set("NewDepartment__c",newDeptId);

contactUpdateList[0] = contactUpdate;

//Update the Contact
var resultsCon = sforceClient.update(contactUpdateList);

contactUpdateList.save();
 

Message Edited by milliskenny on 10-03-2006 01:51 AM

Is this possible?
Say you have a custom tab: objects called: lots with lot_01, lot_02, etc. (Each lot object has a custom checkbox field: In_Use.) You have a custom field (lookup) in opportunities called "Space:"
Let's say you goto Oppurtunity "X" and lookup and choose "lot_01" for field "Space". Now I want to goto Oppurtunity "Y" and populate the field "Space" using the lookup feature. Since lot_01 has been used in Opportunity "X", when I select the lookup for field, I do not want "lot_01" to be a choice. Once the field "Space" on Opportunity "X" is blanked out, then lot_01 appears within the lookup list again.
(Users can be trusted to not enter junk manually into the field) 
I don't have to use Lookup list - I can go with a picklist - I just need to draw from a pool of items while preventing the same list item from existing in more than one Opportunity.
Is this possible? 
 
Thanks.

Our firm generates a product code by running a coder.exe application, which reads product description from a file: data_in.txt 

Calculate the product code and return it in a file: data_out.zip

 

We would like to use our coder from SalesForce,

Meaning:

 

Run our application from SalesForce Tab by pressing a button.

The application should get a data_in.txt file as an input from SalesForce

And return the code to SalesForce in a data_out.zip file as a result.

 

Is there any apex exchange software that can help us do this? Does anyone have experience in doing these kinds of things?

Can someone give us an example on how to do this?

 

Thanks

Hi all,

I'm trying to send the following SOAP msg:
<?xml version='1.0' encoding='UTF-8'?>    
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>   
<soapenv:Header> <ns1:SessionHeader soapenv:mustUnderstand='0'
   xmlns:ns1='urn:enterprise.soap.sforce.com'>   
<ns2:sessionId xmlns:ns2='urn:enterprise.soap.sforce.com'>AsNCSeX5jsUoLXQ=</ns2:sessionId>   
</ns1:SessionHeader>
<ns3:QueryOptions soapenv:mustUnderstand='0' xmlns:ns3='SoapService'>     
<ns4:batchSize xmlns:ns4='urn:enterprise.soap.sforce.com'>100</ns4:batchSize>
</ns3:QueryOptions> </soapenv:Header>    
<soapenv:Body> <query xmlns='urn:enterprise.soap.sforce.com'>
<queryString>SELECT contactId, lastModifiedDate, Case_Reason__c,
Customer_Svc_Related__c FROM Case WHERE lastModifiedDate <= 2006-09-21T02:00:01Z
AND  Customer_Svc_Related__c = 'Yes' AND isClosed = True
</queryString></query> </soapenv:Body> </soapenv:Envelope>

...And I get the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln
s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSc
hema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server</faultcode>
   <faultstring>org.xml.sax.SAXParseException: The content of elements must cons
ist of well-formed character data or markup.</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
 


BUT-  the weird part is if I make the "WHERE" clause
into  "...lastModifiedDate >= 2006-09-21T02:00:01Z"
instead of "WHERE lastModifiedDate <= 2006-09-21T02:00:01Z" - it works fine-

Anyone have a fix or an alternative to this coding?


Thanks in advance.

KC

Is there a small guide somewhere on how to run the eclipse program somewhere?  I have it installed with the plug-in but don't know what to use as the SOAP Endpoint.  Do I use the AppExchange project?
 
Thanks, Chris
When running the app as below with my SalesForce name and password and I get
"Could not connect to host".  Anyone know what could be causing this?  I do have admin priviledges on my salesforce account.


require_once ('../soapclient/SforcePartnerClient.php5');

try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
  $mylogin = $mySforceConnection->login("name@vocera.com", "password");
 
  $userResult = $mylogin->userInfo;
  echo $userResult->userFullName.', '.$userResult->userEmail.', your session id is '.$mylogin->sessionId;
} catch (Exception $e) {
  echo $e->faultstring;
}
Hi,
I meet a new problem.

A custom object has been created in salesforce to call a survey.

In salesforce, a click on the survey link opens a new window where the survey appears. When the survey is finished, i wish to close the survey window and refresh the parent salesforce page.

I know to close the survey window (javascript) but i don't know how to refresh the parent page.

if i create a html page from an other, i know how to close child page and refresh the parent.
But it seems that it's different with salesforce.

Any ideas ?

Thanks,
chris