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
sean_at_33050sean_at_33050 

creating picklist from external database

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 
RickyGRickyG
You might want to investigate the Meta-Data API, which is in Developers Preview in the new version of the API.  Have you considered created an S-control that references an external Web service through Salesforce SOA?
 
Hope this helps.
 
- Rick Greenwald
Developer Evangelist