简体   繁体   English

如何在Salesforce中使用C#和SOQL读取textarea字段?

[英]How to read a textarea field using C# and SOQL in Salesforce?

How can I read a textarea field using C# and SOQL in Salesforce. 如何在Salesforce中使用C#和SOQL读取textarea字段。 I am using Salesforce partner WSDL. 我正在使用Salesforce合作伙伴WSDL。 Currently I am using getFieldValue() to get String values from the SOQL result set but the same is not working for textarea. 目前,我正在使用getFieldValue()从SOQL结果集中获取String值,但是对于textarea而言,该方法不起作用。 I think I am missing something here. 我想我在这里错过了一些东西。

Thanks for looking into it. 感谢您调查。

Code for getting field value 获取字段值的代码

 private string getFieldValue(string fieldName, System.Xml.XmlElement[] fields)
        {
            string returnValue = "";
            if (fields != null)
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    if (fields[i].LocalName.ToLower().Equals(fieldName.ToLower()))
                    {
                        returnValue = fields[i].InnerText;
                    }
                }
            }
            return returnValue;
        }


 private System.Xml.XmlElement GetNewXmlElement(string Name, string nodeValue)
        {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            System.Xml.XmlElement xmlel = doc.CreateElement(Name);
            xmlel.InnerText = nodeValue;
            return xmlel;
        }

Now getFieldValue works in almost all scenarios apart from textarea. 现在,除了文本区域外,getFieldValue几乎可以在所有情况下使用。

If you view the record using the debugger can you see a value in the field? 如果使用调试器查看记录,则可以在该字段中看到一个值吗? This could boil down to many things, some intricacy of the C# library, or, for instance, if your salesforce user doesn't have access to that particular field (due to field level security) then the value would not be returned to you even if you've queried that field. 这可能归结为很多事情,C#库有些复杂,或者例如,如果您的salesforce用户无权访问该特定字段(由于字段级别的安全性),那么该值甚至都不会返回给您。如果您已查询该字段。

My suggestions: 我的建议:

  1. Ensure your user does have access to that field, using SOQL explorer or similar to verify this, or just check the configuration in Salesforce. 使用SOQL资源管理器或类似工具来确保您的用户确实具有对该字段的访问权限,以验证这一点,或者仅检查Salesforce中的配置。

  2. Check the documentation for any special consideration in relation to text areas, these can't be checked in a WHERE clause for instance. 检查文档是否有与文本区域有关的特殊注意事项,例如,不能在WHERE子句中检查这些内容。

  3. See if you can see a value in the field using the debugger. 查看是否可以使用调试器在字段中看到一个值。

  4. Post a code sample :) 发布代码示例:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM