Salesforce 如何提取SOQL对象的所有可用查询字段?

Salesforce 如何提取SOQL对象的所有可用查询字段?,salesforce,Salesforce,因此,我发现Stackoverflow比实际的Salesforce社区反应更快,我将我的问题转发给: 如何为SOQL对象提取所有可用查询字段的列表?我已经准备好了DataLoader脚本,但是我需要一种方法来提取特定SOQL数据对象的所有查询字段,并将它们输入到DataLoader中的process-conf.xml文件中,以将所有这些字段的值提取到一个单独的位置。我已经设置了DataLoader值,但是我需要一种方法来获取所有可用的查询字段,因为它们会继续更改。ANT迁移工具本身似乎无法提取查

因此,我发现Stackoverflow比实际的Salesforce社区反应更快,我将我的问题转发给:

如何为SOQL对象提取所有可用查询字段的列表?我已经准备好了DataLoader脚本,但是我需要一种方法来提取特定SOQL数据对象的所有查询字段,并将它们输入到DataLoader中的process-conf.xml文件中,以将所有这些字段的值提取到一个单独的位置。我已经设置了DataLoader值,但是我需要一种方法来获取所有可用的查询字段,因为它们会继续更改。ANT迁移工具本身似乎无法提取查询字段

ANT工具配置:

# build.properties  
# Specify the login credentials for the desired Salesforce organization
sf.username = <test user acct>
sf.password = <password>
#sf.sessionId = <Insert your Salesforce session id here.  Use this or username/password above.  Cannot use both>
#sf.pkgName = <Insert comma separated package names to be retrieved>
#sf.zipFile = <Insert path of the zipfile to be retrieved>
#sf.metadataType = <Insert metadata type name for which listMetadata or bulkRetrieve operations are to be performed>   
sf.serverurl = https://na3.salesforce.com
sf.maxPoll = 20
# If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration.
#
logType=Detail
#build.properties
#指定所需Salesforce组织的登录凭据
sf.username=
sf.password=
#sf.sessionId=
#sf.pkgName=
#sf.zipFile=
#sf.metadataType=
sf.serverurl=https://na3.salesforce.com
sf.maxPoll=20
#如果您的网络需要HTTP代理,请参阅http://ant.apache.org/manual/proxy.html 用于配置。
#
日志类型=详细信息
build.xml

<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>

    <!-- Setting default value for username, password and session id properties to empty string 
         so unset values are treated as empty. Without this, ant expressions such as ${sf.username}
         will be treated literally.
    -->
    <condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
    <condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
    <condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>

    <taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
        <classpath>
            <pathelement location="ant-salesforce.jar" />           
        </classpath>
    </taskdef>

    <!-- See what happens here -->
    <target name="retrieveSOQL">
      <sf:retrieve 
          username="${sf.username}" 
          password="${sf.password}" 
          sessionId="${sf.sessionId}"
          serverurl="${sf.serverurl}" 
          retrieveTarget="output" 
          unpackaged="package.xml"/>
    </target>
</project>

Package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
        <members>Opportunity</members>
        <members>Lead</members>
        <members>Event</members>
        <members>Project__c</members>
        <name>CustomObject</name>
    </types>
    <version>41.0</version>
</Package>

账户
机会
领导
事件
项目c
自定义对象
41
process-conf.xml

<beans>
    <bean id="AccountExtract"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.debugMessages" value="false"/>
                <entry key="sfdc.debugMessagesFile" value="C:\Users\user\Desktop\salesforce_backup\sfdcSoapTrace.log"/>
                <entry key="sfdc.endpoint" value="https://na3.salesforce.com"/>
                <entry key="sfdc.username" value="<username>"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="<password>"/>
                <entry key="process.encryptionKeyFile" value="key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="sfdc.extractionRequestSize" value="500"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, RecordTypeId, ParentId, BillingStreet FROM Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="dataAccess.type" value="csvWrite"/>
                <entry key="dataAccess.name" value="C:\Users\user\Desktop\account.csv"/>
            </map>
        </property>
    </bean>
...
</beans>

csvAccountExtract作业
...

能否请您添加有关DataLoader和Ant配置的更多详细信息?看起来您需要编写自定义脚本,在Ant作业之前通过REST或SOAP API从所需的Salesforce对象中提取字段名称。Gleb,您能更具体地说明您的问题吗?您想在我如何设置ANT中查看配置文件吗,因为这就是潜在的问题所在?Dataloader有一个简单的批处理脚本,它从ANT迁移工具从Salesforce提取的查询字段中提取SOQL表值,我认为问题在于并非所有需要的字段都是从ANT提取的。是的,我介绍了您使用的ANT配置。它将帮助其他用户清楚地了解您的情况,并更快地帮助您。也许这个讨论可以帮助你-谢谢你。这是正确的话题。他们的解决方案似乎对build.xml文件做了一些工作,因为在运行ANT迁移工具后,它下载xml文件中的表,我通过Powershell脚本解析输出,以提取相关字段。我在DataLoaderWebUI中看到的缺失字段不会出现在已下载的XML文件中。