Salesforce SOAP 创建记录 [英] Salesforce SOAP create record

查看:46
本文介绍了Salesforce SOAP 创建记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码来插入记录(我将插入 1000 个).我得到了一个成功的插入,但所有的数字字段在 salesforce 中都是空的.一个文本字段工作正常(Church of Randy")并出现在 salesforce 中.任何想法我可能做错了什么?

I have the following code to insert a record (I will be inserting 1000's). I get a successful insert but all of the numeric fields are EMPTY in salesforce. The one text field works fine ("Church of Randy") and appears in salesforce. Any ideas what I could be doing wrong?

  public void InsertTestRecord()
    {

        ChurchHist__c ch = new ChurchHist__c();


        ch.ChurchId__c = 9999;
        ch.ChurchName__c = "Church of Randy";
        ch.ReportYear__c = 2013;
        ch.ReportMonth__c = 08;
        ch.RegisteredMembers__c = 777;
        ch.ActiveMembers__c = 111;
        ch.InactiveMembers__c = 666;
        ch.UsersForMonth__c = 25;
        ch.ContribForMonth__c = 789.01;
        ch.ContribYTD__c = 200000.02;
        ch.AchContrib__c = 200000.00;
        ch.CcContrib__c = 0.02;
        ch.AchToCc__c = 0.12345;

        sObject[] s = new sObject[1];
        s[0] = ch;
        try
        {
            SaveResult[] saveResult = binding.create(s);

            if (saveResult[0].success)
            {
                Debug.Print("Success");
            }
            else
            {
                foreach (Error error in saveResult[0].errors)
                {
                    Debug.Print(error.statusCode.ToString());
                    Debug.Print(error.message);

                }
            }
        }
        catch (SoapException se)
        {
            Debug.Print(se.ToString());

        }

    }

推荐答案

您需要设置指定的标志,例如数字属性有一个关联的指定标志,用于控制 .NET 肥皂引擎是否实际通过网络发送该属性,不幸的是,该属性的设置器不会自动设置指定的标志.例如

You need to set the specified flags, e.g. numeric property has an associated specified flag that controls if the .NET soap engine will actually send that property over the wire, unfortuantly the setter for the property does not automatically set the specified flag. e.g.

ch.ChurchId__c = 9999;
ch.ChurchId__cSpecified = true;
ch.reportyear__c = 2013;
ch.reportyear__cSpecified = true;

指定的标志是某些类型的 .NET 肥皂系统的功能".(数字和日期 IIRC).

The specified flags are a "feature" of the .NET soap system for certain types. (numbers & dates IIRC).

这篇关于Salesforce SOAP 创建记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆