crm - 微软动态插件

标签 crm

生活怎么样... 我是 Microsoft Dynamics 的新手...

谁能告诉我为什么这段代码对账号有效,但对收入没有任何作用...不会在字段中写入值???

using System;

// Microsoft Dynamics CRM namespace(s)
using Microsoft.Xrm.Sdk;

namespace Microsoft.Crm.Sdk.Samples
{
    public class accountManager : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            // Obtain the execution context from the service provider.
            Microsoft.Xrm.Sdk.IPluginExecutionContext context =  Microsoft.Xrm.Sdk.IPluginExecutionContext)
            serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));      

        // The InputParameters collection contains all the data passed in the message request.
        if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
        {
            // Obtain the target entity from the input parameters.
            Entity entity = (Entity)context.InputParameters["Target"];

            switch(entity.LogicalName)
            {

                case "account":

                    int accountNumber;
                    accountNumber = 100;
                    entity.Attributes.Add("accountnumber", accountNumber.ToString());

                    int accountRevenu;
                    accountRevenu = 1000;
                    entity.Attributes.Add("revenue", accountRevenu.ToString());

                    break;
            }       
        }
    }
}

}

致以诚挚的问候 斯蒂芬

最佳答案

收入是“货币”字段,因此您应该尝试使用以下代码:

entity["revenue"] = new Money(1000);

关于crm - 微软动态插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32972788/

相关文章:

Git存储库不克隆

sdk - Dynamics CRM 使用 C# 代码合并两个联系人,从 SDK 修改示例

api - 使用 PHP 通过 API 将记录插入到 Zoho CRM

javascript - 如何从 CRM 2011 中的相关实体提取数据

javascript - 检查表单是否已保存在 CRM 2011 Javascript 中

ios - 如何在 iOS 中使用 MS CRM 2011 Web 服务?

水平对齐框的 CSS 问题

dynamics-crm-2011 - 如何在 CRM 2011 中隐藏预过滤器窗口?

c# - 在 QueryExpression 中包含 OptionSetValue

.net - 可同步的CRM系统