0

I have created code that will use the acumatica API to insert a case and then insert attributes into that case. (This functions properly)

Here is the insert of the Attribute to the case, it functions correctly:

// Add the attribute to the Case
CR306000 = context.CR306000GetSchema();
context.CR306000Clear();
CR306000Content[] resultAttributes = context.CR306000Submit(
new Command[] { 
    new Value { Value = sCaseID, LinkedCommand = CR306000.CaseSummary.CaseID, Commit = true },
    new Value { Value = "Asset ID", LinkedCommand = CR306000.Attributes.Attribute },
    new Value { Value = "X22345", LinkedCommand = CR306000.Attributes.Value, Commit = true },
CR306000.Actions.Save
}
);

When I get to inserting a related task, the task is not getting created. The error message I get is Error #98: View Activites doesn't exist.

Any suggestions on how to insert a related task to the case?

Here is the code that does not insert the task.

CR306010Content CR306020 = context.CR306010GetSchema();
context.CR306020Clear();
context.CR306020Submit( 
new Command[]
{
new Value { Value = "New Task For CaseID=[" +sCaseID + "]", LinkedCommand = CR306020.Details.Summary, Commit=true },
new Value { Value = sCaseID, LinkedCommand = CR306020.Details.RelatedEntity },
new Value { Value = "000001", LinkedCommand = new Field { ObjectName = CR306020.Details.RelatedEntity.ObjectName, FieldName = "RefNoteID" } },
new Value { Value = "False", LinkedCommand = CR306020.Details.Billable },
new Value { Value = "Administrative", LinkedCommand = CR306020.Details.Workgroup },
new Value { Value = "EP00000002", LinkedCommand = CR306020.Details.Owner },
new Value { Value = "X", LinkedCommand = CR306020.Details.Project },
new Value { Value = "Task Description", LinkedCommand = CR306020.Details.Task},
new Value { Value = "Open", LinkedCommand = CR306020.Details.Status, Commit = true },
CR306020.Actions.SaveClose
}
);
4

1 回答 1

0

感谢 Dhiren 在这方面的帮助。

try
{

  var commands = new LocalAPI.Command[]
  {
    new LocalAPI.Value { Value = strCaseNumber,  LinkedCommand = CR306000.CaseSummary.CaseID, Commit = true },
    CR306000.Actions.NewTask,
  };
  screen.CR306000Submit(commands);
}
catch (Exception x1)
{
  message = x1.Message;
}

// Adds a task to the case or order linked on NoteID and RefNoteID
LocalAPI.CR306020Content CR306020 = screen.CR306020GetSchema();
var taskresult = screen.CR306020Submit(
                    new LocalAPI.Command[]
                        {
                            new LocalAPI.Value { Value = "New Task - N7", LinkedCommand = CR306020.Details.Summary  },
                            new LocalAPI.Value { Value = "X", LinkedCommand = CR306020.Details.Project  },
                            new LocalAPI.Value { Value = DateTime.Now.ToString(), LinkedCommand = CR306020.Details.StartDate},
                            new LocalAPI.Value { Value = DateTime.Now.AddDays(18).ToString(), LinkedCommand = CR306020.Details.DueDate},
                            new LocalAPI.Value { Value = "FINANCE", LinkedCommand = CR306020.Details.Workgroup},
                            new LocalAPI.Value { Value = "EP00000003", LinkedCommand = CR306020.Details.AssignedTo},
                            new LocalAPI.Value { Value = "Normal", LinkedCommand = CR306020.Details.Priority},
                            new LocalAPI.Value { Value = "Open", LinkedCommand = CR306020.Details.Status},
                            new LocalAPI.Value { Value = "false" , LinkedCommand = CR306020.Details.Reminder},
                            new LocalAPI.Value { Value = "More and more stuff will be added in this section", LinkedCommand = CR306020.Details.ActivityDetails},

                            CR306020.Actions.Save
                        });
于 2015-02-16T23:00:31.763 回答