Xavier LARTEM
Xavier LARTEM

Reputation: 139

Update selected failed

I use this code to open another screen in SO301000

    public virtual IEnumerable EcrListemodele(PXAdapter adapter)
    {
        var cmdencours = TransactionsOrder.Current;
        if (cmdencours==null) return adapter.Get();

        ZMODELEFILTER.Current.Immatriculation=cmdencours.GetExtension<SOOrderExt>().UsrImmatriculation;
        ZMODELEFILTER.AskExt();
           foreach (ZMODELE un_modele in SOZmodele.Select())
                {
                   if (un_modele.Selected == true)
                    {
                    cmdencours.GetExtension<SOOrderExt>().Usrlistmodele=un_modele.Modele;
                    cmdencours.GetExtension<SOOrderExt>().Usrlistpiece=un_modele.Piece;
                    TransactionsOrder.Update(cmdencours);

                   }
                }
         //}

        return adapter.Get();
    }  

I have this error when I select one option enter image description here

enter image description here

Thanks, Xavier

Upvotes: 0

Views: 35

Answers (1)

KRichardson
KRichardson

Reputation: 1010

Make sure that the audit fields use the proper attributes. For example, CreatedByID uses:

        #region CreatedByID
        public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID>
        {
        }
        protected Guid? _CreatedByID;
        [PXDBCreatedByID()]
        public virtual Guid? CreatedByID
        {
            get
            {
                return this._CreatedByID;
            }
            set
            {
                this._CreatedByID = value;
            }
        }
        #endregion

The attributes you would want to use on the respective fields are:

  • PXDBCreatedByID
  • PXDBCreatedByScreenID
  • PXDBCreatedDateTime
  • PXDBLastModifiedByID
  • PXDBLastModifiedByScreenID
  • PXDBLastModifiedDateTime
  • PXDBTimestamp

Upvotes: 1

Related Questions