I still cannot figure out how to dispatch a requisition with an EFx (or BPM, etc.)

EDIT FROM THE FUTURE

Solution is post 3, as indicated.

In post 14, We figured out my problem with widgets, and that is that I have UD fields on the ReqHead table (actually just one, Plant_c), and the Fill Table by Query widget is not equipped for that.

And now, the original post.


I need help. I promise I have tried all I can think of already. Yes, I am doing this with widgets, but I will take (working) code at this point. I’ve seen snippets, but no one was yet kind enough to share the whole shebang. (I will likely try to reverse-engineer it and widgetize it. Or use as-is.)

For the uninitiated, there is no DispatchReq method of the Req BO. I wish.

Instead, a second row is magically added to the ReqHead table of the dataset, and certain fields are populated/changed. Then call the Update method.

The main existing post on this is here, and below I have pasted the likely solution in its entirety:

Yeah, it wants 2 lines in your dataset before the update: the initial one without any changes and RowMod=“” and the second one with the changes and RowMod=“U”.

First, call the GetByID to get the full req dataset (in this case tsReq). Then copy the header and set the fields:

// copy header
var currentRow = tsReq.ReqHead[0];
var newRow = tsReq.ReqHead.NewRow();
BufferCopy.CopyExceptFor(currentRow, newRow, "");

// set fields for the new header
newRow["NextDispatcherID"] = "ApproverIDHere";
newRow["NextActionID"] = "APPR";
newRow["ReplyOption"] = "A";
newRow["ReqUserId"] = "RequestorIDHere";
newRow["RowMod"] = "U";

// add new header to tableset
tsReq.ReqHead.Add(newRow);   

Finally, call the Update. Worked for me.

To give context, here is what I see when I compare the two rows of the trace on the Update.

Same fields as the snippet above, but I see more:

  • Adding the note (optional, OK fine)
  • Adding descriptions (likely not stored in the DB; this is probably purely a UI thing, OK fine)
  • Adding an entire new field to the second row!

To explain that, notice that BOTH have ReqUserId but only the right side (added row) has ReqUserID (with capital D; highlighted blue).

This does not correlate to others’ advice; they do not add this field; instead they just populate ReqUserId (lowercase D) on the added row. Is this irrelevant? Seems so, since others report success.


What I have done, with widgets, is:

  1. Create Epicor Function with several inputs
  2. Call GetByID method (of Req BO)
  3. Use “Fill Table by Query” widget
    a. Query the existing (one) row of the dataset
    b. Map fields like the pic below
  4. Call Update method (of Req BO)

But when I test this, I get a useless error, which correlates to another useless error: Object reference not set to an instance of an object.

I learned out how to dump the auto-generated code, if it helps.

Expand for code
using Epicor.Customization.Bpm;
using Epicor.Data;
using Epicor.Hosting;
using Epicor.Utilities;
using Erp;
using Erp.Tables;
using Ice;
using Ice.Contracts;
using Ice.Customization.Sandbox;
using Ice.ExtendedData;
using Ice.Tables;
using Ice.Tablesets;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;

namespace EFx.ReqDCLib.Implementation
{
    partial class Dispatch2Impl
    {
        protected override int RunStep(int workflowStep)
        {
            var conditionBlockValue = false;

            switch (workflowStep)
            {
                case Epicor.Functions.PredefinedStep.Start: // Req GetByID
                  using (var widgetContext = this.SetWidgetContext("Req GetByID", "InvokeBOMethodAction2"))
                  {
                    try
                    {
                        this.A001_InvokeBOMethodAction2();
                    }
                    catch (Ice.Common.BusinessObjectException ex)
                    {
                        this.RememberException(ex);
                    }
                    return 1;
                  }
                case 1: // row count 1
                  using (var widgetContext = this.SetWidgetContext("row count 1", "SetArgumentAction"))
                  {
                    try
                    {
                        this.A002_SetArgumentAction();
                    }
                    catch (Ice.Common.BusinessObjectException ex)
                    {
                        this.RememberException(ex);
                    }
                    return 2;
                  }
                case 2: // Add row for update
                  using (var widgetContext = this.SetWidgetContext("Add row for update", "FillTableByQueryAction"))
                  {
                    try
                    {
                        this.A003_FillTableByQueryAction();
                    }
                    catch (Ice.Common.BusinessObjectException ex)
                    {
                        this.RememberException(ex);
                    }
                    return 3;
                  }
                case 3: // Update Req
                  using (var widgetContext = this.SetWidgetContext("Update Req", "InvokeBOMethodAction2"))
                  {
                    try
                    {
                        this.A004_InvokeBOMethodAction2();
                    }
                    catch (Ice.Common.BusinessObjectException ex)
                    {
                        this.RememberException(ex);
                    }
                    return 4;
                  }
                case 4: // Set Argument/Variable 1
                  using (var widgetContext = this.SetWidgetContext("Set Argument/Variable 1", "SetArgumentAction"))
                  {
                    try
                    {
                        this.A005_SetArgumentAction();
                    }
                    catch (Ice.Common.BusinessObjectException ex)
                    {
                        this.RememberException(ex);
                    }
                    return Epicor.Functions.PredefinedStep.Exit;
                  }
                default:
                    return Epicor.Functions.PredefinedStep.Unknown;
            }
        }

        private void A001_InvokeBOMethodAction2()
        {
            this.CallService<Erp.Contracts.ReqSvcContract>(
                bo =>
                {
                    dsReq = bo.GetByID(
                        ReqID);
                });
        }

        private void A002_SetArgumentAction()
        {
            this.output = this.A002_SetArgumentAction_Value();
        }
        
        [Epicor.Customization.CustomCode]
        private System.String A002_SetArgumentAction_Value()
        {
            return ("Header rows: " +  dsReq.ReqHead.Count.ToString());
        }

        private class A003_FillTableByQueryAction__QueryRow
        {
            public System.String dsReq_ReqHead_Company { get; set; }
            public System.Boolean dsReq_ReqHead_OpenReq { get; set; }
            public System.Int32 dsReq_ReqHead_ReqNum { get; set; }
            public System.String dsReq_ReqHead_RequestorID { get; set; }
            public System.DateTime? dsReq_ReqHead_RequestDate { get; set; }
            public System.String dsReq_ReqHead_ShipName { get; set; }
            public System.String dsReq_ReqHead_ShipAddress1 { get; set; }
            public System.String dsReq_ReqHead_ShipAddress2 { get; set; }
            public System.String dsReq_ReqHead_ShipAddress3 { get; set; }
            public System.String dsReq_ReqHead_ShipCity { get; set; }
            public System.String dsReq_ReqHead_ShipState { get; set; }
            public System.String dsReq_ReqHead_ShipZIP { get; set; }
            public System.String dsReq_ReqHead_ShipCountry { get; set; }
            public System.Int32 dsReq_ReqHead_PrcConNum { get; set; }
            public System.String dsReq_ReqHead_CommentText { get; set; }
            public System.String dsReq_ReqHead_ShipToConName { get; set; }
            public System.Int32 dsReq_ReqHead_ShipCountryNum { get; set; }
            public System.String dsReq_ReqHead_ReqActionID { get; set; }
            public System.String dsReq_ReqHead_CurrDispatcherID { get; set; }
            public System.Boolean dsReq_ReqHead_NotifyUponReceipt { get; set; }
            public System.String dsReq_ReqHead_Note { get; set; }
            public System.String dsReq_ReqHead_StatusType { get; set; }
            public System.String dsReq_ReqHead_GlbCompany { get; set; }
            public System.Int32 dsReq_ReqHead_GlbReqNum { get; set; }
            public System.String dsReq_ReqHead_CPDispatcherID { get; set; }
            public System.Guid dsReq_ReqHead_SysRowID { get; set; }
            public System.String dsReq_ReqHead_CreatedBy { get; set; }
            public System.DateTime? dsReq_ReqHead_CreatedOn { get; set; }
            public System.String dsReq_ReqHead_AddrList { get; set; }
            public System.String dsReq_ReqHead_CurrDispatcherCurMenuID { get; set; }
            public System.Boolean dsReq_ReqHead_LockLines { get; set; }
            public System.Boolean dsReq_ReqHead_MemoAvailable { get; set; }
            public System.String dsReq_ReqHead_NextActionDesc { get; set; }
            public System.String dsReq_ReqHead_NextActionID { get; set; }
            public System.String dsReq_ReqHead_NextDispatcherID { get; set; }
            public System.String dsReq_ReqHead_NextDispatcherName { get; set; }
            public System.String dsReq_ReqHead_NextNote { get; set; }
            public System.Boolean dsReq_ReqHead_OkToBuy { get; set; }
            public System.String dsReq_ReqHead_ReplyOption { get; set; }
            public System.String dsReq_ReqHead_RequestorIDCurMenuID { get; set; }
            public System.String dsReq_ReqHead_ReqUserId { get; set; }
            public System.String dsReq_ReqHead_StatusDesc { get; set; }
            public System.Boolean dsReq_ReqHead_ToDoFlag { get; set; }
            public System.String dsReq_ReqHead_ShipToAddressFormatted { get; set; }
            public System.Int32 dsReq_ReqHead_BitFlag { get; set; }
            public System.String dsReq_ReqHead_CurrDispatcherName { get; set; }
            public System.String dsReq_ReqHead_ReqActionIDReqActionDesc { get; set; }
            public System.String dsReq_ReqHead_RequestorIDName { get; set; }
            public System.Boolean dsReq_ReqHead_XbSystDisableOverridePriceListOption { get; set; }
            public System.String dsReq_ReqHead_RowMod { get; set; }
            public System.String dsReq_ReqHead_Plant_c { get; set; }
            public System.Int64 dsReq_ReqHead_SysRevID { get; set; }
        }
        
        private void A003_FillTableByQueryAction()
        {
            var companyDateTimeForCriteria_at_A003_FillTableByQueryAction = Ice.Lib.CompanyTime.Now();
            var lazyQueryGen =
                from rowdsReq_ReqHead in dsReq.ReqHead
                select new A003_FillTableByQueryAction__QueryRow
                    {
                        dsReq_ReqHead_Company = rowdsReq_ReqHead.Company,
                        dsReq_ReqHead_OpenReq = rowdsReq_ReqHead.OpenReq,
                        dsReq_ReqHead_ReqNum = rowdsReq_ReqHead.ReqNum,
                        dsReq_ReqHead_RequestorID = rowdsReq_ReqHead.RequestorID,
                        dsReq_ReqHead_RequestDate = rowdsReq_ReqHead.RequestDate,
                        dsReq_ReqHead_ShipName = rowdsReq_ReqHead.ShipName,
                        dsReq_ReqHead_ShipAddress1 = rowdsReq_ReqHead.ShipAddress1,
                        dsReq_ReqHead_ShipAddress2 = rowdsReq_ReqHead.ShipAddress2,
                        dsReq_ReqHead_ShipAddress3 = rowdsReq_ReqHead.ShipAddress3,
                        dsReq_ReqHead_ShipCity = rowdsReq_ReqHead.ShipCity,
                        dsReq_ReqHead_ShipState = rowdsReq_ReqHead.ShipState,
                        dsReq_ReqHead_ShipZIP = rowdsReq_ReqHead.ShipZIP,
                        dsReq_ReqHead_ShipCountry = rowdsReq_ReqHead.ShipCountry,
                        dsReq_ReqHead_PrcConNum = rowdsReq_ReqHead.PrcConNum,
                        dsReq_ReqHead_CommentText = rowdsReq_ReqHead.CommentText,
                        dsReq_ReqHead_ShipToConName = rowdsReq_ReqHead.ShipToConName,
                        dsReq_ReqHead_ShipCountryNum = rowdsReq_ReqHead.ShipCountryNum,
                        dsReq_ReqHead_ReqActionID = rowdsReq_ReqHead.ReqActionID,
                        dsReq_ReqHead_CurrDispatcherID = rowdsReq_ReqHead.CurrDispatcherID,
                        dsReq_ReqHead_NotifyUponReceipt = rowdsReq_ReqHead.NotifyUponReceipt,
                        dsReq_ReqHead_Note = rowdsReq_ReqHead.Note,
                        dsReq_ReqHead_StatusType = rowdsReq_ReqHead.StatusType,
                        dsReq_ReqHead_GlbCompany = rowdsReq_ReqHead.GlbCompany,
                        dsReq_ReqHead_GlbReqNum = rowdsReq_ReqHead.GlbReqNum,
                        dsReq_ReqHead_CPDispatcherID = rowdsReq_ReqHead.CPDispatcherID,
                        dsReq_ReqHead_SysRowID = rowdsReq_ReqHead.SysRowID,
                        dsReq_ReqHead_CreatedBy = rowdsReq_ReqHead.CreatedBy,
                        dsReq_ReqHead_CreatedOn = rowdsReq_ReqHead.CreatedOn,
                        dsReq_ReqHead_AddrList = rowdsReq_ReqHead.AddrList,
                        dsReq_ReqHead_CurrDispatcherCurMenuID = rowdsReq_ReqHead.CurrDispatcherCurMenuID,
                        dsReq_ReqHead_LockLines = rowdsReq_ReqHead.LockLines,
                        dsReq_ReqHead_MemoAvailable = rowdsReq_ReqHead.MemoAvailable,
                        dsReq_ReqHead_NextActionDesc = rowdsReq_ReqHead.NextActionDesc,
                        dsReq_ReqHead_NextActionID = rowdsReq_ReqHead.NextActionID,
                        dsReq_ReqHead_NextDispatcherID = rowdsReq_ReqHead.NextDispatcherID,
                        dsReq_ReqHead_NextDispatcherName = rowdsReq_ReqHead.NextDispatcherName,
                        dsReq_ReqHead_NextNote = rowdsReq_ReqHead.NextNote,
                        dsReq_ReqHead_OkToBuy = rowdsReq_ReqHead.OkToBuy,
                        dsReq_ReqHead_ReplyOption = rowdsReq_ReqHead.ReplyOption,
                        dsReq_ReqHead_RequestorIDCurMenuID = rowdsReq_ReqHead.RequestorIDCurMenuID,
                        dsReq_ReqHead_ReqUserId = rowdsReq_ReqHead.ReqUserId,
                        dsReq_ReqHead_StatusDesc = rowdsReq_ReqHead.StatusDesc,
                        dsReq_ReqHead_ToDoFlag = rowdsReq_ReqHead.ToDoFlag,
                        dsReq_ReqHead_ShipToAddressFormatted = rowdsReq_ReqHead.ShipToAddressFormatted,
                        dsReq_ReqHead_BitFlag = rowdsReq_ReqHead.BitFlag,
                        dsReq_ReqHead_CurrDispatcherName = rowdsReq_ReqHead.CurrDispatcherName,
                        dsReq_ReqHead_ReqActionIDReqActionDesc = rowdsReq_ReqHead.ReqActionIDReqActionDesc,
                        dsReq_ReqHead_RequestorIDName = rowdsReq_ReqHead.RequestorIDName,
                        dsReq_ReqHead_XbSystDisableOverridePriceListOption = rowdsReq_ReqHead.XbSystDisableOverridePriceListOption,
                        dsReq_ReqHead_RowMod = rowdsReq_ReqHead.RowMod,
                        dsReq_ReqHead_Plant_c = rowdsReq_ReqHead.UDField<System.String>("Plant_c"),
                        dsReq_ReqHead_SysRevID = rowdsReq_ReqHead.SysRevID,
                    };
            var queryRowsGen = lazyQueryGen.ToList();
        
            foreach (var queryRow in queryRowsGen)
            {
                var addedRowGen = new Erp.Tablesets.ReqHeadRow();
        
                addedRowGen.Company = queryRow.dsReq_ReqHead_Company;
                addedRowGen.OpenReq = queryRow.dsReq_ReqHead_OpenReq;
                addedRowGen.ReqNum = queryRow.dsReq_ReqHead_ReqNum;
                addedRowGen.RequestorID = queryRow.dsReq_ReqHead_RequestorID;
                addedRowGen.RequestDate = queryRow.dsReq_ReqHead_RequestDate;
                addedRowGen.ShipName = queryRow.dsReq_ReqHead_ShipName;
                addedRowGen.ShipAddress1 = queryRow.dsReq_ReqHead_ShipAddress1;
                addedRowGen.ShipAddress2 = queryRow.dsReq_ReqHead_ShipAddress2;
                addedRowGen.ShipAddress3 = queryRow.dsReq_ReqHead_ShipAddress3;
                addedRowGen.ShipCity = queryRow.dsReq_ReqHead_ShipCity;
                addedRowGen.ShipState = queryRow.dsReq_ReqHead_ShipState;
                addedRowGen.ShipZIP = queryRow.dsReq_ReqHead_ShipZIP;
                addedRowGen.ShipCountry = queryRow.dsReq_ReqHead_ShipCountry;
                addedRowGen.PrcConNum = queryRow.dsReq_ReqHead_PrcConNum;
                addedRowGen.CommentText = queryRow.dsReq_ReqHead_CommentText;
                addedRowGen.ShipToConName = queryRow.dsReq_ReqHead_ShipToConName;
                addedRowGen.ShipCountryNum = queryRow.dsReq_ReqHead_ShipCountryNum;
                addedRowGen.ReqActionID = queryRow.dsReq_ReqHead_ReqActionID;
                addedRowGen.CurrDispatcherID = queryRow.dsReq_ReqHead_CurrDispatcherID;
                addedRowGen.NotifyUponReceipt = queryRow.dsReq_ReqHead_NotifyUponReceipt;
                addedRowGen.Note = queryRow.dsReq_ReqHead_Note;
                addedRowGen.StatusType = queryRow.dsReq_ReqHead_StatusType;
                addedRowGen.GlbCompany = queryRow.dsReq_ReqHead_GlbCompany;
                addedRowGen.GlbReqNum = queryRow.dsReq_ReqHead_GlbReqNum;
                addedRowGen.CPDispatcherID = queryRow.dsReq_ReqHead_CPDispatcherID;
                addedRowGen.SysRevID = queryRow.dsReq_ReqHead_SysRevID;
                addedRowGen.SysRowID = queryRow.dsReq_ReqHead_SysRowID;
                addedRowGen.CreatedBy = queryRow.dsReq_ReqHead_CreatedBy;
                addedRowGen.CreatedOn = queryRow.dsReq_ReqHead_CreatedOn;
                addedRowGen.AddrList = queryRow.dsReq_ReqHead_AddrList;
                addedRowGen.CurrDispatcherCurMenuID = queryRow.dsReq_ReqHead_CurrDispatcherCurMenuID;
                addedRowGen.LockLines = queryRow.dsReq_ReqHead_LockLines;
                addedRowGen.MemoAvailable = queryRow.dsReq_ReqHead_MemoAvailable;
                addedRowGen.NextActionDesc = queryRow.dsReq_ReqHead_NextActionID;
                addedRowGen.NextActionID = ReqAction;
                addedRowGen.NextDispatcherID = DispatcherID;
                addedRowGen.NextDispatcherName = queryRow.dsReq_ReqHead_NextDispatcherName;
                addedRowGen.NextNote = queryRow.dsReq_ReqHead_NextNote;
                addedRowGen.OkToBuy = queryRow.dsReq_ReqHead_OkToBuy;
                addedRowGen.ReplyOption = Approval;
                addedRowGen.RequestorIDCurMenuID = queryRow.dsReq_ReqHead_RequestorIDCurMenuID;
                addedRowGen.ReqUserId = UserID;
                addedRowGen.StatusDesc = queryRow.dsReq_ReqHead_StatusDesc;
                addedRowGen.ToDoFlag = queryRow.dsReq_ReqHead_ToDoFlag;
                addedRowGen.ShipToAddressFormatted = queryRow.dsReq_ReqHead_ShipToAddressFormatted;
                addedRowGen.BitFlag = queryRow.dsReq_ReqHead_BitFlag;
                addedRowGen.CurrDispatcherName = queryRow.dsReq_ReqHead_CurrDispatcherName;
                addedRowGen.ReqActionIDReqActionDesc = queryRow.dsReq_ReqHead_ReqActionIDReqActionDesc;
                addedRowGen.RequestorIDName = queryRow.dsReq_ReqHead_RequestorIDName;
                addedRowGen.XbSystDisableOverridePriceListOption = queryRow.dsReq_ReqHead_XbSystDisableOverridePriceListOption;
                addedRowGen.RowMod = A003_FillTableByQueryAction_RowMod(queryRow, addedRowGen);
                addedRowGen["Plant_c"] = queryRow.dsReq_ReqHead_Plant_c;
        
                dsReq.ReqHead.Add(addedRowGen);
            }
        }
        
        [Epicor.Customization.CustomCode]
        private System.String A003_FillTableByQueryAction_RowMod(A003_FillTableByQueryAction__QueryRow queryRow, Erp.Tablesets.ReqHeadRow addedRowGen)
        {
            return ("U");
        }

        private void A004_InvokeBOMethodAction2()
        {
            this.CallService<Erp.Contracts.ReqSvcContract>(
                bo =>
                {
                    bo.Update(
                        ref dsReq);
                });
        }

        private void A005_SetArgumentAction()
        {
            this.output = this.A005_SetArgumentAction_Value();
        }
        
        [Epicor.Customization.CustomCode]
        private System.String A005_SetArgumentAction_Value()
        {
            return ("Header rows: " +  dsReq.ReqHead.Count.ToString());
        }
    }
}

Any thoughts?

2 Likes

I would try something like the follwowing to get it dispatched:

var apvDs = Svc.GetByID(reqHeadRow.ReqNum);
        
        var rhRow = apvDs.ReqHead.FirstOrDefault();
        
        string warnMsg;
        
         var updatedRow = (Erp.Tablesets.ReqHeadRow)apvDs.ReqHead.NewRow();  
         
        BufferCopy.Copy(rhRow, updatedRow);
        apvDs.ReqHead.Add(updatedRow);  

        Svc.CheckReqDetail(updatedRow.ReqNum, out warnMsg);
     
        string nextActionID = "AUTOAPRV";
        updatedRow.NextActionID = nextActionID;
        updatedRow.ReplyOption = "A";
        updatedRow.ReqUserId = callContextClient.CurrentUserId;
        updatedRow.RowMod = "U";
       
        Svc.BuildNextDispatcher_SingleList(nextActionID);
        
        Svc.Update(ref apvDs);
        
        bool displayReq;
        bool resetDispatch;
        bool morePages;
        
        Svc.RDMenuFlags(rhRow.ReqNum, rhRow.RequestorID, out displayReq, out resetDispatch);
        Svc.CheckToDo(rhRow.RequestorID);
        Svc.GetReqLogList($"ReqNum = {rhRow.ReqNum}", 0, 1, out morePages);
2 Likes

Hi Jason,

That code I sent there is basically all there is. I am attaching a function that has everything in it: getbyid, the code and then the update. This works for me for version 10.2.700. Hope that helps.

REQ.efxb (24.2 KB)

3 Likes

Goodness, it literally is just that! And it worked fine for me (after changing the action ID to one in my system).

Well thank you a lot, and I still want to figure this out, but that’s pretty simple!

3 Likes

Out of curiosity, is there a way to dump a dataset to a string?

I am calling the EFx from Postman, but I wanted to see inside the dataset, to see what it has for the data in the rows.

Like, I can go field by field like this

dsReq.ReqHead[0].ReqUserId + ", " + dsReq.ReqHead[1].ReqUserId

and store that in an output of the EFx.

But I was hoping to see the whole thing, like I can do with a trace of the UI.

1 Like

Use Newtonsoft.Json, it has a serialize/deserialze function for datasets, this is the simplest method (there are plenty of other ways too)

//references: Newtonsoft.Json
//using Newtonsoft.Json
string json = JsonConvert.SerializeObject(ds, Formatting.Indented);
2 Likes

You could also simply output the dataset from the function as a variable, this will show in postman as the full dataset (it is really just serializing it to a string with newtonsoft.json the same way)

1 Like

I feel like (a) you’re right and I have done that before, and (b) I have tried that lately and failed.

For both of your responses, I am using widgets and am struggling with applying your suggestions.

I added here, but that was not enough, it seems.

(I tried the first alone, then added the second on a whim.)

1 Like

Hmmm, i’ve never done it in a widget function, I think i’ve maybe only written 2 or 3 widget functions, after i experienced how painful a complicated case/when statement or daisy chained if/true/false statements are, i stopped using them :smiling_face_with_tear: before I even learned what a dataset was, lol

Edit: it looks like the “Fill Table by Query” function wants to output to a well defined tableset, whereas a dataset is a dynamically designed object, im not really sure how you even get data into a dataset in widgets, lol

2 Likes

So the output idea. They have a generic dataset Type, but I cannot shove the real dataset into it.

If I select the real thing (I think), Erp.Tablesets.ReqHeadTableset

Then it does not show in the list of “argument/variables.”

1 Like

Basically GetByID or GetRows. Then manipulate from there.

1 Like

Since in this case, you are actually working with a TableSet, i think you can change your function signature to directly output that, which should give you visibility.


Then you can “Fill Table By Query” directly to that ts.

2 Likes

Ha, you are correct!

OK, so the norm with widgets is that you do your GetByID or whatever, then choose “create new variable” for the output.

The beauty of this is that it knows what wacky Type you need (Erp.Tablesets.ReqHeadTableset) and makes the variable in that Type.

But to get the dataset into the output of the EFx, I needed to define the output (in the signature), in that type, first, and then choose it in the GetByID.

2 Likes

Well I see this sole difference.

So, I have a UD field (Plant_c) on ReqHead, and I think that yellow field (UD_SysRevID) is the FKV or something related.

The EFx from @Dragos has the yellow field in both rows. My EFx is missing it on row 2 of the dataset. I would guess this is causing the error.

So perhaps the insert widget cannot handle a table (View) with UD fields?

2 Likes

YES!!! Vindicated!

I was doing everything right; this is the issue.

So, I went into another dev DB I have (still on 2024.2, standing by for 2025.2) and blew away the UD field/table on ReqHead. Then I re-created the EFx with all widgets, and bam! It works!

So this here, “Fill Table By Query,” fails when the table has UD fields.

I’ll report it, but it makes me think that no one has done this (widget to add row to dataset with UD fields) in, what, 20 years of BPMs being around?? No way.

5 Likes

PRB0315132

:crossed_fingers: