Skip to main content
Solved

NoteID error when creating new custom screen record from Move Screen


Forum|alt.badge.img+7
  • Captain II
  • 296 replies

Hey guys,

 

I am having an issue with a custom action I have written, I think, in accordance with the T190 training course.

Below is the error I get:

This is my code for the method & the action:

//method declaration
private static void createQCCheck(AMBatch batch)
{
    using (var ts = new PXTransactionScope())
    {
        var qCEntry = PXGraph.CreateInstance<GCQualityControlEntry>();

        QualityControl doc = new QualityControl() { };
       // AMMTran batch = new AMMTran();

        doc = qCEntry.QCCheck.Insert(doc);
        doc.BatchNbr = batch.BatNbr;
        doc.Date = batch.TranDate;
        qCEntry.QCCheck.Update(doc);


        var batchEntry = PXGraph.CreateInstance<MoveEntry>();
        batchEntry.batch.Current = batch;




        foreach (AMMTran line in batchEntry.transactions.Select())
        {

                var lines = qCEntry.Details.Insert();
                lines.AMProdOrdID = line.ProdOrdID;
                qCEntry.Details.Update(lines);
        }

        qCEntry.Actions.PressSave();

        ts.Complete();

    }
}
//Action declaration
        public PXAction<AMBatch> CreateQCCheck;
        [PXButton(DisplayOnMainToolbar = true)]
        [PXUIField(DisplayName = "Start QC Checks", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
        protected virtual IEnumerable createQCCheck(PXAdapter adapter) 
        {
           List<AMBatch> list = new List<AMBatch>();
            foreach(AMBatch batch in  adapter.Get<AMBatch>())
            {
                list.Add(batch);
            }

            var batches = AMBatches.Current;
            PXLongOperation.StartOperation(this, delegate () { createQCCheck(batches); });

            return list;
        }

 

Best answer by aiwan

Hi All,

I am not experienced enough to know what exactly caused the bug, however, I managed to overcome it by dropping the NoteID column from the DB and reintroducing it.

If anyone would like to share their thoughts on why this could have happened, I would greatly appreciate it.

Hope you all have a lovely day!

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+7
  • Author
  • Captain II
  • 296 replies
  • July 8, 2024

Hey all,

Just as an update, I have reset cache and restarted the application in case anything was stuck in the cache.

I have checked the source data and the database and couldn’t find the NoteID specified in the error message.


Forum|alt.badge.img+7
  • Author
  • Captain II
  • 296 replies
  • Answer
  • July 8, 2024

Hi All,

I am not experienced enough to know what exactly caused the bug, however, I managed to overcome it by dropping the NoteID column from the DB and reintroducing it.

If anyone would like to share their thoughts on why this could have happened, I would greatly appreciate it.

Hope you all have a lovely day!


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2657 replies
  • July 8, 2024

Thank you for sharing your solution with the community @aiwan!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings