Acumatica 添加“时获取错误”;联络;通过web服务API

Acumatica 添加“时获取错误”;联络;通过web服务API,acumatica,Acumatica,我试图通过web服务添加“联系人”,但不断出现如下错误: Failed to convert parameter value from a String to a Int32. ---> System.FormatException: Input string was not in a correct format. //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.

我试图通过web服务添加“联系人”,但不断出现如下错误:

Failed to convert parameter value from a String to a Int32. ---> System.FormatException: Input string was not in a correct format.
//cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
如果我将该行注释如下:

Failed to convert parameter value from a String to a Int32. ---> System.FormatException: Input string was not in a correct format.
//cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
//cmds.Add(新值{Value=”“,LinkedCommand=CR302000.ContactSummary.ContactID});
我没有得到任何错误,但没有任何联系补充

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
代码如下:

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
CR302000Content CR302000=context.CR302000GetSchema();
CR302000Clear();
List cmds=新列表();
//添加标题信息
//添加(新值{Value=”“,LinkedCommand=CR302000.ContactSummary.ContactID});
Add(新值{Value=contact.LastName,LinkedCommand=CR302000.DetailsSummary.LastName});
Add(新值{Value=“CA”,LinkedCommand=CR302000.DetailsAddress.Country});
添加(CR302000.Actions.Save);
CR302000Content[]CR302000Content=context.CR302000Submit(cmds.ToArray());
谁能帮我让我知道我做错了什么

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());

谢谢。

问题是你在屏幕上看到的实际上是显示名称,而不是真正的联系人ID。这是一个特殊的领域,Acumatica在很多地方都这样做,我只是在解决这个问题

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
您应该尝试在显示名称中使用标记,这可能会做到。(我猜这些标签引用了您的Web服务以获取DisplayName上的正确名称)

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());
cmds.Add(新值{Value=”“,LinkedCommand=CR302000.ContactSummary.DisplayName});
或者,您可以提取分配的最后一个ContactID并增加该数字(+1),并将其用作CR302000.ContactSummary.ContactID的值,该值也应保存记录

应该有命令(操作)插入,我想您可以使用

            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());

CR302000.Actions.Insert而不是使用键

我一定错过了什么-我的代码现在可以正常工作了。我仍然使用与我在这里发布的代码相同的代码,其中包括注释掉的“联系人ID”和“Actions.Save”,但它不知怎么起作用了。不知道为什么,但我现在结束这个问题。感谢那些已经回复的家伙。

我试着用“插入”而不是“保存”,但运气不好。
            CR302000Content CR302000 = context.CR302000GetSchema();
            context.CR302000Clear();

            List<Command> cmds = new List<Command>();               

            //add header info

            //cmds.Add(new Value { Value = "<NEW>", LinkedCommand = CR302000.ContactSummary.ContactID });
            cmds.Add(new Value { Value = contact.LastName, LinkedCommand = CR302000.DetailsSummary.LastName });

            cmds.Add(new Value { Value = "CA", LinkedCommand = CR302000.DetailsAddress.Country });


            cmds.Add(CR302000.Actions.Save);

            CR302000Content[] CR302000content = context.CR302000Submit(cmds.ToArray());