通过代码为案例屏幕插入新活动

时间:2018-09-03 19:54:32

标签: acumatica

我正在尝试为Case插入一个新的Activity。我编写的代码执行没有任何错误,但它甚至没有插入任何活动。让我知道我是否想念任何东西。

这是代码

CRActivity actiCloud9 = new CRActivity();

actiCloud9.Type = "N";      // Note
actiCloud9.Subject = current.Summary;
actiCloud9.Body = current.Description;
actiCloud9.UIStatus = current.Status;
actiCloud9.StartDate = current.StartDate;
actiCloud9.IsPrivate = true;        // current.IsInternal;
actiCloud9.RefNoteID = Base.CaseCurrent.Current.NoteID;

Base.Activities.Cache.Insert(actiCloud9);

1 个答案:

答案 0 :(得分:1)

尝试一下。

    [PXOverride]
    public void Persist(Action del)
    {
        if ((Base.Case.Cache.GetStatus(Base.Case.Current) == PXEntryStatus.Inserted || Base.Case.Cache.GetStatus(Base.Case.Current) == PXEntryStatus.Updated))
        {
            CRActivityMaint objGraph = PXGraph.CreateInstance<CRActivityMaint>();

            CRActivity actiCloud9 = new CRActivity();

            actiCloud9.Type = "N";      // Note
            actiCloud9.Subject = "Subject";
            actiCloud9.Body = "Body";
            actiCloud9.RefNoteID = Base.CaseCurrent.Current.NoteID;

            objGraph.Activities.Cache.Insert(actiCloud9);
            objGraph.Actions.PressSave();
        }

        del();
    }