No results returned from Ice.Contracts.BO.UD12.dll - GetByID, GetRows

I’m trying to select a row based on Key1 of the UD12 table, then update it. Key2 through Key5 are empty.

My code so far is below. Using the GetByID method, no rows are returned even though I know there is a matching entry in the database. Using the GetRows method, I also seem to get no results.

I’ve also tried the BL Tester with those methods and get no results. Any ideas what I’m doing wrong?

Thanks!

bool morePages;
try {
  this.CallService<Ice.Contracts.UD12SvcContract>(ud12Svc => {
    //var ud12ds = ud12Svc.GetByID("abcd1234", string.Empty, string.Empty, string.Empty, string.Empty);
    //line above causes error: Record not found. 
    var ud12ds = ud12Svc.GetRows("Key1 = 'abcd1234'", string.Empty, 0, 1, out morePages);
    Epicor.Hosting.Trace.ServerLog.WriteTraceMessage("trace://ice/log", "Debug", () => "ud12ds is set.");
    var result = ud12ds.UD12.FirstOrDefault();
    //line above causes error : Object reference not set to an instance of an object.
    Epicor.Hosting.Trace.ServerLog.WriteTraceMessage("trace://ice/log", "Debug", () => "result is: " + result.ToString());
    /*
    result.ShortChar04 = "Dude!";
    result.RowMod = "U";
    ud12Svc.Update(ref ud12ds);
    */
  });
}
catch(Exception ex) {
  Epicor.Hosting.Trace.ServerLog.WriteTraceMessage("trace://ice/log", "Debug", () => "Message is: " + ex.Message);
}

What do you get if the where clause is set to
"Key1 LIKE 'abcd%'"

Or

"Key1 LIKE '%'"

Let’s see a baq of that table with all 5 key fields visible.

I get no errors with your exact code.

I built a BAQ and returned the expected data. I’m wondering if there is a permission issue on the account to access the BO.

select 
	[UD12].[Key1] as [UD12_Key1],
	[UD12].[Key2] as [UD12_Key2],
	[UD12].[Key3] as [UD12_Key3],
	[UD12].[Key4] as [UD12_Key4],
	[UD12].[Key5] as [UD12_Key5]
from Ice.UD12 as UD12
where (UD12.Key1 like '%')

image

Great idea - I tried those and still get no results from BL Tester or from the Function. :thinking:

I recall seeing some posts about GetRows not returning UD columns (columns added to a standard table, you know the ones that end with “_c”). It would be really strange if that applied to UD tables too - especially since they are native tables in Epicor.

I’d play with tweaking the code to see if you can successfully get records from a simple table. Try the proverbial lab rat “ABC Codes”.

Maybe something in this topic will help

edit

Post #17 in that thread has a working sample that uses GetRows() instead of GetById()

Good thinking that it could be an issue with a UD table vs. a standard table. I ran a test with ABC Code, and that worked fine. But that is in Erp and I’m trying to work on an Ice object, so I tested with Ice.Theme - this worked fine! So there’s definitely a read access issue specifically with UD12.

The post from skearny was helpful, but in that case an Adapter is being used, and I’ve been told here that Functions have to use a Service Contract.

I ran another test to see if I could read from UD110 with the same code, and it worked! Unfortunately, I can’t use table UD110 since it is already in use. So I need to segment/figure out if any other available UD tables allow read access with a Service Contract.

Thanks for all the help everyone.

I would assume that if UD110 works they all do.

So your code works for UD110 - meaning can get the data you expect from the table UD110. This would lead me to believe that your code syntax is correct, but there’s something about the data in UD12, that is throwing you off.

When you try it on UD12, you never get any records back? Are you sure you don’t have a record in UD12 where Keys 1 through 5 are all NULL?

I checked if there were any entries where all keys where null using a BAQ: this gave zero results.

I think there is a data issue: I copied a row, including the exact key values, from UD110 into UD107 and was unable to retrieve the UD107 row in BL Tester. I wanted to test if UD1 through UD40 were treated differently than UD100 through UD110 tables.

I’m wondering if data inserted using SSMS instead of Epicor business logic is somehow blocked or ignored.

Run a BAQ and include ALL the fields including SysRowID etc. See if they are populated.

1 Like

Yessir,

I get the auto-generated fields for SysRevID and SysRowID. I also tried retrieving a row using GetBySysRowID with no results returned.
image

First off …
:exploding_head:
for manipulation of the DB via SQL. And how were the SysRowID and SysRevID values set?

When you load UD12 Maintenance form, does the data show up?

SysRowID and sysRevID are auto-generated if they are not specified with an insert.

I don’t know about the UD12 Maintenance form - I found the UD Column Maintenance app which I think you are referring to; there’s no entry for UD12.

However, I think I need to change my approach and use the REST API for populating the data, then see if the problem persists. I found this in the forums:

UD Column Maintenance is not it.

(UD12 Maintenance form)
You will have to add it to the menu from menu maintenance.
Epicor has built in forms for all the ud tables.

Ice.UI.UD12Entry.dll for the menu item under program