Error
This content is not currently supported on this browser.
+ Start a Discussion
Sandra OSandra O 
Hello - I am getting a Unekpected Token Illegal for my button to assign ownership to the person that clicks the button.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

// identify the record 
var c = new sforce.SObject("Checklist__c"); 
c.id = "{!Checklist__c.Id}"; 

// make the field change 
c.Ownerid= {!$User.Id}; 


// save the change 
sforce.connection.update([c]); 

//refresh the page 
window.location.reload();
Best Answer chosen by Sandra O
Sandra OSandra O
Answered my own question...

I needed to change c.Ownerid= {!$User.Id}; to c.OwnerId="{!$User.Id}"
Dhaval PanchalDhaval Panchal 

Hello,

 

I want to delete 500+ custom fields. Is there any solution to mass remove custom fields? I have tried with metadata Api using below code. But it gives me below error.

 

Object with id:04s900000037qo4AAA is InProgress
Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: members - no CustomField named Custom_Field__c found
Object with id:04s900000037qo4AAA is Error

 

Below is the code:

 


    public void deleteCustomField(String fullname) throws Exception
    {
        CustomField customField = new CustomField();
        customField.setFullName(fullname);
        
        UpdateMetadata updateMetadata = new UpdateMetadata();
        updateMetadata.setMetadata(customField);
        updateMetadata.setCurrentName(fullname);
        
        AsyncResult[] asyncResults  = metadataConnection.delete(new Metadata[] {customField});
 
        long waitTimeMilliSecs = ONE_SECOND;
 
        do
        {
            printAsyncResultStatus(asyncResults);
            waitTimeMilliSecs *= 2;
            Thread.sleep(waitTimeMilliSecs);
            asyncResults = metadataConnection.checkStatus(new String[]{asyncResults[0].getId()});
        } while (!asyncResults[0].isDone());
 
        printAsyncResultStatus(asyncResults);
    }

 


    private void printAsyncResultStatus(AsyncResult[] asyncResults) throws Exception {
        if (asyncResults == null || asyncResults.length == 0 || asyncResults[0] == null) {
            throw new Exception("The object status cannot be retrieved");
        }

        AsyncResult asyncResult = asyncResults[0]; //we are creating only 1 metadata object

        if (asyncResult.getStatusCode() != null) {
            System.out.println("Error status code: " +
                    asyncResult.getStatusCode());
            System.out.println("Error message: " + asyncResult.getMessage());
        }

        System.out.println("Object with id:" + asyncResult.getId() + " is " +
            asyncResult.getState());
    }

 

Is there any other solution (any app) to removing custom fields?

 

Thanks in advance,

 

Dhaval Panchal

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

Using ANT and SFDC Migration tool I am now able to delete bulk custom fields.

Download Apache Ant using below link:

Extract and copy this folder where you want to keetp (i have copied this folder to "C" drive : C:\apache-ant-1.9.2)
Set path in environment variables for ant.
To set environment variables
-> Right click on My Computer -> Property -> Advance System Setting -> Click on Environment variables button.
-> click on System variables -> Click on New -> Give variable name = ANT_HOME and variable value = [your and path]
see below images.


Now go to your salesforce account
click on
Setup -> Develop -> Tools -> Force.com Migration Tool.
Download "salesforce_ant_28.0" and extract this zip file.
You will file "ant-salesforce.jar" file in extracted folder, copy this
jar file to "C:\apache-ant-1.9.2\lib"

Now go to folder salesforce_ant_28.0 -> sample
open file "build.properties" and provide your username, password and token there.
In sample folder you will find xml file formates using that you can deploy components.

cnewmancnewman 
Hi Everyone,

Is there anyway I can have a confirmation box ask which action, from two options, I want to perform or cancel the operation?

I need a button on the Opportunity, that once pressed asks if you want to postone, close or cancel the action. First two options will change the status accordingly and the last will close the box and action nothing.

I'm familiar with the normal Yes/No confirmation box, not sure if this is possible?

Thanks
Chris
Best Answer chosen by cnewman
srlawr uksrlawr uk
If you check out this accepted answer on StackOverflow you'll see that in order to have a three button javascript alert box, you need to expand outside of native javascript support. JQuery libraries are easy to inlude in visualforce pages, and hopefully with a bit of tweeking the JS block provided in this answer will ive you what you want..

http://stackoverflow.com/questions/9091001/how-to-show-confirmation-alert-with-three-buttons-yes-no-and-cancel-as-it

I imagine (of course!) instead of just popping up an alert as to which button you pressed you are going to shoot off and do some apex remoting to call a controller method?
CW83CW83 
I have a javascript button I am trying to create to update a picklist field on a custom object.  Here is the code for the button:

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);

The code is not throwing errors on the object it is just not updating the field.  The page is reloading. Anything wrong with the code?

Best Answer chosen by CW83
logontokartiklogontokartik
Looks like you missed "!" in your merge field it must be {!Projects__c.Id}. Also you can alert on result.message if you want to see any errors.
jud008jud008 

According to SOAP API Developer's Guide - Introducing SOAP API: Development Platforms different versions of the WSC tool can be obtained from http://code.google.com/p/sfdc-wsc/ and http://mvnrepository.com/artifact/com.force.api/force-wsc.

 

However, the latest version on the google-code site is wsc-22 whereas the latest on mvnrepository is wsc-26. On the other hand, the link to source code given on mvnrepository (http://github.com/forcedotcom/wsc) seems to be dead.


Which is which and which version should one use?

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

WSC is now available from its new home on Github https://github.com/forcedotcom/wsc

Kevin WrightKevin Wright 

I feel I'm almost there :)

 

The code below connects to the Salesforce server but ultimately fails with a 'no endpoint' exception.

 

I think I'm just not passing on the protocol credentials such as service and url endpoint to the object making the call,  but

I'm only guessing.

 

Also are there any pieces of sample code that make a WebService call from Java as I've not been able to find any?

 

Can anyone help me please?

 

 

 

import com.sforce.soap.schemas._class.MyWebService.*;
import java.net.*;
import com.sforce.soap.enterprise.*;
import com.sforce.soap.enterprise.fault.LoginFault;
import com.sforce.soap.enterprise.fault.ExceptionCode;

 

public class TestCall{

 

 public static void main(String[] args){

                LoginResult loginResult;

  System.out.println("start of program");
  try{

  SoapBindingStub bind=  (SoapBindingStub) new SforceServiceLocator().getSoap();
                System.out.println("after call to getSoap()");
  bind.setTimeout(60000);

   
  loginResult = bind.login("myadminuser", "mypassword");
  System.out.println("straight after login call");
  bind._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

    com.sforce.soap.enterprise.SessionHeader sh = new com.sforce.soap.enterprise.SessionHeader();
          sh.setSessionId(loginResult.getSessionId());
      
   
         bind.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                          "SessionHeader", sh);
       
              

   MyWebServiceBindingStub stub = new MyWebServiceBindingStub();

   

   System.out.println("about to make call");
   stub.myMethod();
  }
    catch (LoginFault ex) {
            // The LoginFault derives from AxisFault

            ExceptionCode exCode = ex.getExceptionCode();
            System.out.println("######" + exCode);
            if (exCode == ExceptionCode.FUNCTIONALITY_NOT_ENABLED ||
                exCode == ExceptionCode.INVALID_CLIENT ||
                exCode == ExceptionCode.INVALID_LOGIN ||
                exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_DOMAIN ||
                exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_TIME ||
                exCode == ExceptionCode.ORG_LOCKED ||
                exCode == ExceptionCode.PASSWORD_LOCKOUT ||
                exCode == ExceptionCode.SERVER_UNAVAILABLE ||
                exCode == ExceptionCode.TRIAL_EXPIRED ||
                exCode == ExceptionCode.UNSUPPORTED_CLIENT) {
                System.out.println("Please be sure that you have a valid username " +
                     "and password.");
            } else {
                // Write the fault code to the console

                System.out.println(ex.getExceptionCode());
                // Write the fault message to the console

                System.out.println("An unexpected error has occurred." + ex.getMessage());
            }
  

  }
   catch(Exception e){
   System.out.println("error" + e.getMessage());
  }

 }

 


}

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Kevin WrightKevin Wright

Success!! The following code sucessfully calls an Apex Web Service from Java. The System log indicates the call is being

made. I am sure there is a certain amount of duplication of operations in this code and it needs cleaning up. But it does work! :smileyhappy:

 

 

 

 

 

import com.sforce.soap.schemas._class.MyWebService.*;
import java.net.*;
import com.sforce.soap.enterprise.*;
import com.sforce.soap.enterprise.fault.LoginFault;
import com.sforce.soap.enterprise.fault.ExceptionCode;

 

public class TestCall{

 

 public static void main(String[] args){

                LoginResult loginResult;

  System.out.println("start of program");
  try{

  SoapBindingStub bind=  (SoapBindingStub) new SforceServiceLocator().getSoap();
                System.out.println("after call to getSoap()");
  bind.setTimeout(60000);


  loginResult = bind.login("adminusername", "adminpassword");
  System.out.println("straight after login call");
  bind._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

    com.sforce.soap.enterprise.SessionHeader sh = new com.sforce.soap.enterprise.SessionHeader();
          sh.setSessionId(loginResult.getSessionId());


         bind.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                          "SessionHeader", sh);

   MyWebServiceServiceLocator locator = new MyWebServiceServiceLocator();

   //************ new stuff here.
      //ApexWebServiceTestService svc = new ApexWebServiceTestServiceLocator();

      java.net.URL url = new java.net.URL(locator.getMyWebServiceAddress());

   MyWebServiceBindingStub stub = new MyWebServiceBindingStub(url, locator);


              //SessionHeader sh = new SessionHeader();
              //sh.setSessionId(sessionId);

          String sforceURI = locator.getMyWebServiceAddress();
              stub.setHeader(sforceURI, "SessionHeader", sh);


   // ***********end of new stuff


   System.out.println("about to make call");
   stub.myMethod();
  }
    catch (LoginFault ex) {
            // The LoginFault derives from AxisFault

            ExceptionCode exCode = ex.getExceptionCode();
            System.out.println("######" + exCode);
            if (exCode == ExceptionCode.FUNCTIONALITY_NOT_ENABLED ||
                exCode == ExceptionCode.INVALID_CLIENT ||
                exCode == ExceptionCode.INVALID_LOGIN ||
                exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_DOMAIN ||
                exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_TIME ||
                exCode == ExceptionCode.ORG_LOCKED ||
                exCode == ExceptionCode.PASSWORD_LOCKOUT ||
                exCode == ExceptionCode.SERVER_UNAVAILABLE ||
                exCode == ExceptionCode.TRIAL_EXPIRED ||
                exCode == ExceptionCode.UNSUPPORTED_CLIENT) {
                System.out.println("Please be sure that you have a valid username " +
                     "and password.");
            } else {
                // Write the fault code to the console

                System.out.println(ex.getExceptionCode());
                // Write the fault message to the console

                System.out.println("An unexpected error has occurred." + ex.getMessage());
            }


  }
   catch(Exception e){
   System.out.println("error" + e.getMessage());
  }

 }


}

rramaiahrramaiah 

Any idea why I get a "field integrity exception" error when I try to update SOME PricebookEntry objects?  It doesn't happen for all Pricebooks/PricebookEntry objects, just some, but I can't figure out whether there's a pattern.  I'm definitely using a valid PricebookEntryId.  Any ideas are appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
rramaiahrramaiah
I figured out the problem.  In the web interface, the "Use Standard Price" checkbox was checked, making the value unalterable through the SForce API.
MilanMilan 
Hello,

Recently we have seen a number of errors such as the following in our logs:

Invalid Session ID found in SessionHeader: Illegal Session

Our app integrates with SalesForce AppExchange. From what I've read, this error may mean that the user's SalesForce session has expired, although they may still be able to interact with our application in the AppEx frameset. This seems to make some sense in that the point in the user's experience where we are seeing this error is during checkout, which means that it may be possible for them to have been using the app long enough for their Sales Force session to expire.

Does this error really indicate that the user's SalesForce session has expired and, if so, is there something I can do through integration to help keep it alive or re-initialize it? How do other people deal with this issue?
Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf
If this is an Scontrol and you're within an Iframe that has been redirected, sometimes you have to manually set the session ID from the cookie because it doesn't pick it up automatically.  I can't remember the exact syntax because I can't find the org in which I did this, but it's something like:

Code:
sforce.sessionId = getCookie('sid');

It becomes reasonably obvious when you use Firebug to debug just before your login call that the session ID variable is unset, and so you just have to set it before you do anything.

If this is _not_ an Scontrol, then make sure you're not losing your sessionId somewhere in the process.  That would also cause this problem.  Also, as you surmised, if the user is legitimately timed out then you'll get this issue, in which case the only fix is to get a new sessionId by re-logging in.
QingsongQingsong 
 

 
I am using apex data loader 11.0 command line to extract data to CSV file, it's works, I would like to extract data from salesforce directly into MS SQL 2005, I was spent a lot of time to try and search the knowadge in this community but still not able to get this works, below is my code in database-con.xml:
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dbDataSource"
      class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://localhost;databaseName=CRMReport;"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>


<bean id="tmpAccount"
      class="com.salesforce.lexiloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig" ref="queryAccount"/>
    <property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccount"
      class="com.salesforce.lexiloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
 select Id, IsDeleted, MasterRecordId, 
  Name, Type, RecordTypeId, ParentId, 
  BillingStreet, BillingCity, BillingState, 
  BillingPostalCode, BillingCountry, ShippingStreet, 
  ShippingCity, ShippingState, ShippingPostalCode, 
  ShippingCountry, Phone, Fax, 
  Website, Industry, AnnualRevenue, 
  NumberOfEmployees, 
  Description, CurrencyIsoCode, 
  OwnerId, CreatedDate, CreatedById, 
  LastModifiedDate, LastModifiedById, 
  SystemModstamp, LastActivityDate, 
  Region__c, Annual_Procurment__c, 
  Trial_Balance_Code__c, Customer_Group__c, 
  SAP_VEGA_1_Account_Number__c, 
  SAP_VEGA_2_Account_Number__c, 
  QAD_Account_Number__c, 
  BAAN_Account_Number__c, Brief_Name__c,Customer_PBU__c
 from tmpAccount
        </value>
    </property>
</bean>
</beans>


 
and then I have process-conf.xml as well:
 
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <!-- Extract Account to CSV File -->
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 11.0\Delphi\Conf\ExtractAccountMap.sdl"/>
                <entry key="dataAccess.type" value="databaseWrite"/>
                <entry key="dataAccess.name" value="tmpAccount"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, 
                     RecordTypeId, ParentId, BillingStreet, BillingCity, 
                     BillingState, BillingPostalCode, BillingCountry, 
                     ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, 
                     ShippingCountry, Phone, Fax, Website, Industry, AnnualRevenue, 
                     NumberOfEmployees, Description, CurrencyIsoCode, OwnerId, 
                     CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, 
                     SystemModstamp, LastActivityDate, Region__c, Annual_Procurment__c, 
                     Trial_Balance_Code__c, Customer_Group__c, 
                     SAP_VEGA_1_Account_Number__c, SAP_VEGA_2_Account_Number__c, 
                     QAD_Account_Number__c, BAAN_Account_Number__c, Brief_Name__c, 
                     Customer_PBU__c FROM Account"/>
            </map>
        </property>
    </bean>
</beans>

 

I downloaded the Microsoft SQL Server 2005 JDBC 1.2 into my C:\MSJDBC folder, and changed the original proccess.bat file to:
Code:
@echo off
if not [%1]==[] goto run
echo.
echo Usage: process ^<configuration directory^> ^[process name^]
echo.
echo      configuration directory -- directory that contains configuration files,
echo          i.e. config.properties, process-conf.xml, database-conf.xml
echo.
echo      process name -- optional name of a batch process bean in process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir AccountInsert
echo.
echo          If process name is not specified, the parameter values from config.properties
echo          will be used to run the process instead of process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir
echo.

goto end

:run
set PROCESS_OPTION=
if not [%2]==[] set PROCESS_OPTION=process.name=%2

..\_jvm\bin\java.exe -classpath ..\DataLoader.jar;C:\MSJDBC\sqljdbc_1.2\enu\sqljdbc.jar -Dsalesforce.config.dir=%1 

com.salesforce.lexiloader.process.ProcessRunner %PROCESS_OPTION%

:end

 
and then we I execute the extract in command line:
 
process.bat ./conf csvAccountExtractProcess
 
I was get below errors:
 

177924 [csvAccountExtract] DEBUG com.salesforce.lexiloader.client.PartnerClient - Beginning web service operation: query
320410 [csvAccountExtract] ERROR com.salesforce.lexiloader.dao.database.Database Reader  - Database error encountered while writing row#1 through row#215 (execute batch update). Database configuration: tmpAccount.  Sql error: The SELECT statement is not permitted in a batch..com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT statement is not permitted in a batch.
 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at com.salesforce.lexiloader.dao.database.DatabaseWriter.writeRowList(DatabaseWriter.java:180)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.writeExtraction(QueryVisitor.java:205)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.visit(QueryVisitor.java:111)
        at com.salesforce.lexiloader.action.ExtractAction.execute(ExtractAction.java:108)
        at com.salesforce.lexiloader.controller.Controller.executeAction(Controller.java:126)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:136)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
 at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)

320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - Processed 214 of 214 total records. Rate: 24851000 records per hour. Estimated time to complete: 0 minutes and 0 seconds.  There are 0 successes and 214 errors.
320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - The extract has fully completed.  There were 0 successful extracts and 214 errors.

Looks like the SELECT statement have some problems, I am looking the solution here, any leads very be high appericated, Thanks
 


Message Edited by Qingsong on 04-15-2008 06:57 PM

Message Edited by Qingsong on 04-15-2008 07:09 PM

Message Edited by Qingsong on 04-15-2008 07:13 PM
Best Answer chosen by Admin (Salesforce Developers) 
QingsongQingsong
Good news, I was figure out what's the root cause, for extract data into SQL, It has to be a INSERT statement not a SELECT statement, so I did the change in database-conf.xml as below:
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dbDataSource"
      class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://Localhost:1433;databaseName=CRMReport;"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>


<bean id="tmpAccount"
      class="com.salesforce.lexiloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig" ref="queryAccount"/>
    <property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccount"
      class="com.salesforce.lexiloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
 INSERT INTO dbo.tmpAccount (Id, IsDeleted, MasterRecordId, 
  Name, Type, RecordTypeId, ParentId, 
  BillingStreet, BillingCity, BillingState, 
  BillingPostalCode, BillingCountry, ShippingStreet, 
  ShippingCity, ShippingState, ShippingPostalCode, 
  ShippingCountry, Phone, Fax, 
  Website, Industry, AnnualRevenue, 
  NumberOfEmployees, 
  Description, CurrencyIsoCode, 
  OwnerId, CreatedDate, CreatedById, 
  LastModifiedDate, LastModifiedById, 
  SystemModstamp, LastActivityDate, 
  Region__c, Annual_Procurment__c, 
  Trial_Balance_Code__c, Customer_Group__c, 
  SAP_VEGA_1_Account_Number__c, 
  SAP_VEGA_2_Account_Number__c, 
  QAD_Account_Number__c, 
  BAAN_Account_Number__c, Brief_Name__c,Customer_PBU__c)
 VALUES(@Id@,@IsDeleted@,@MasterRecordId@,@Name@,@Type@,@RecordTypeId@,@ParentId@,
  @BillingStreet@,@BillingCity@,@BillingState@,@BillingPostalCode@,
  @BillingCountry@,@ShippingStreet@,@ShippingCity@,@ShippingState@,
  @ShippingPostalCode@,@ShippingCountry@,@Phone@,@Fax@,@Website@,
  @Industry@,@AnnualRevenue@,@NumberOfEmployees@,@Description@,
  @CurrencyIsoCode@,@OwnerId@,@CreatedDate@,@CreatedById@,
  @LastModifiedDate@,@LastModifiedById@,@SystemModstamp@,
  @LastActivityDate@,@Region__c@,@Annual_Procurment__c@,
  @Trial_Balance_Code__c@,@Customer_Group__c@,@SAP_VEGA_1_Account_Number__c@,
  @SAP_VEGA_2_Account_Number__c@,@QAD_Account_Number__c@,
  @BAAN_Account_Number__c@,@Brief_Name__c@,@Customer_PBU__c@)
        </value>
    </property>
    <property name="sqlParams">
        <map>
        <entry key="Id"    value="java.lang.String"/>
 <entry key="IsDeleted"    value="java.lang.String"/>
 <entry key="MasterRecordId"    value="java.lang.String"/>
 <entry key="Name"    value="java.lang.String"/>
 <entry key="Type"    value="java.lang.String"/>
 <entry key="RecordTypeId"    value="java.lang.String"/>
 <entry key="ParentId"    value="java.lang.String"/>
 <entry key="BillingStreet"    value="java.lang.String"/>
 <entry key="BillingCity"    value="java.lang.String"/>
 <entry key="BillingState"    value="java.lang.String"/>
 <entry key="BillingPostalCode"    value="java.lang.String"/>
 <entry key="BillingCountry"    value="java.lang.String"/>
 <entry key="ShippingStreet"    value="java.lang.String"/>
 <entry key="ShippingCity"    value="java.lang.String"/>
 <entry key="ShippingState"    value="java.lang.String"/>
 <entry key="ShippingPostalCode"    value="java.lang.String"/>
 <entry key="ShippingCountry"    value="java.lang.String"/>
 <entry key="Phone"    value="java.lang.String"/>
 <entry key="Fax"    value="java.lang.String"/>
 <entry key="Website"    value="java.lang.String"/>
 <entry key="Industry"    value="java.lang.String"/>
 <entry key="AnnualRevenue"    value="java.lang.String"/>
 <entry key="NumberOfEmployees"    value="java.lang.String"/>
 <entry key="Description"    value="java.lang.String"/>
 <entry key="CurrencyIsoCode"    value="java.lang.String"/>
 <entry key="OwnerId"    value="java.lang.String"/>
 <entry key="CreatedDate"    value="java.lang.String"/>
 <entry key="CreatedById"    value="java.lang.String"/>
 <entry key="LastModifiedDate"    value="java.lang.String"/>
 <entry key="LastModifiedById"    value="java.lang.String"/>
 <entry key="SystemModstamp"    value="java.lang.String"/>
 <entry key="LastActivityDate"    value="java.lang.String"/>
 <entry key="Region__c"    value="java.lang.String"/>
 <entry key="Annual_Procurment__c"    value="java.lang.String"/>
 <entry key="Trial_Balance_Code__c"    value="java.lang.String"/>
 <entry key="Customer_Group__c"    value="java.lang.String"/>
 <entry key="SAP_VEGA_1_Account_Number__c"    value="java.lang.String"/>
 <entry key="SAP_VEGA_2_Account_Number__c"    value="java.lang.String"/>
 <entry key="QAD_Account_Number__c"    value="java.lang.String"/>
 <entry key="BAAN_Account_Number__c"    value="java.lang.String"/>
 <entry key="Brief_Name__c"    value="java.lang.String"/>
 <entry key="Customer_PBU__c"    value="java.lang.String"/>
        </map>
    </property>
</bean>
</beans>


 
then the mapfile should be same with database-conf and process-conf, it's CASE SENSITIVE, below is my ExtractAccountMap.sdl
Code:
#Mapping values
#Mon Jan 23 17:07:24 PST 2006
Id=Id
IsDeleted=IsDeleted
MasterRecordId=MasterRecordId
Name=Name
Type=Type
RecordTypeId=RecordTypeId
ParentId=ParentId
BillingStreet=BillingStreet
BillingCity=BillingCity
BillingState=BillingState
BillingPostalCode=BillingPostalCode
BillingCountry=BillingCountry
ShippingStreet=ShippingStreet
ShippingCity=ShippingCity
ShippingState=ShippingState
ShippingPostalCode=ShippingPostalCode
ShippingCountry=ShippingCountry
Phone=Phone
Fax=Fax
Website=Website
Industry=Industry
AnnualRevenue=AnnualRevenue
NumberOfEmployees=NumberOfEmployees
Description=Description
CurrencyIsoCode=CurrencyIsoCode
OwnerId=OwnerId
CreatedDate=CreatedDate
CreatedById=CreatedById
LastModifiedDate=LastModifiedDate
LastModifiedById=LastModifiedById
SystemModstamp=SystemModstamp
LastActivityDate=LastActivityDate
Region__c=Region__c
Annual_Procurment__c=Annual_Procurment__c
Trial_Balance_Code__c=Trial_Balance_Code__c
Customer_Group__c=Customer_Group__c
SAP_VEGA_1_Account_Number__c=SAP_VEGA_1_Account_Number__c
SAP_VEGA_2_Account_Number__c=SAP_VEGA_2_Account_Number__c
QAD_Account_Number__c=QAD_Account_Number__c
BAAN_Account_Number__c=BAAN_Account_Number__c
Brief_Name__c=Brief_Name__c
Customer_PBU__c=Customer_PBU__c

 
Right now the only problem is the response time, looks like very slow, there are 214 records takes me 4minutes to run, not quite sure why, please advice...Thanks
JimsmithJimsmith 
 
For Creating Custom Object using Metadata API I am getting the following Error Can any one help?
 
AxisFault
 Exception No operation available for request {http://soap.sforce.com/2006/04/metadata}create
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode:
 faultString: No operation available for request {http://soap.sforce.com/2006/04/metadata}create
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:No operation available for request {http://soap.sforce.com/2006/04/metadata}create
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    .
    .
    .

code:
    private void createCustomObject(){
        CustomObject co = new CustomObject();
        String name = "MyCustomObject1";
        co.setFullName(name + "__c");
        co.setDeploymentStatus(DeploymentStatus.Deployed);
        co.setDescription("Created by the Metadata API");
        co.setEnableActivities(true);
        co.setLabel(name + " Object1");
        co.setPluralLabel(co.getLabel() + "s");
        co.setSharingModel(SharingModel.ReadWrite);
 
        CustomField nf = new CustomField();
        nf.setType(FieldType.Text);
        nf.setLabel(co.getFullName() + " Name");
       
        co.setNameField(nf);
        try
        {
            AsyncResult[] ars = metadataStub.create(new CustomObject[] { co} );
//        AsyncResult[] ars = metadataStub.create(new Metadata[] { co} );
       
        }catch(Exception e)
        {
            System.out.println(" Exception "+e);
            e.printStackTrace();
        }
    }


Already did the following

MetadataBindingStub metadataStub =(MetadataBindingStub) new MetadataServiceLocator().getMetadata();
metadataStub._setProperty(MetadataBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());
          metadataStub.setMaintainSession(true);
metadataStub.setHeader(new MetadataServiceLocator().getServiceName().getNamespaceURI(),
                               "SessionHeader", sh);

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
You're setting the endpoint property to the wrong url, there's a different entry in LoginResult for the metadataServerUrl.