UD Table Adapter

Dear experts, While trying to call GetList function in customization script, system is throwing error “No overload for method ‘GetList’ takes 4 arguments” & code is mentioned below

UD02Adapter objAdapter = new UD02Adapter(this.oTrans);
objAdapter.BOConnect();
bool MorePages;
string whereClouse = “Company = '” + session.CompanyID + “’ AND Key2 = '”+ ProdCode +"’";
DataSet objds = objAdapter.GetList(whereClouse, 0, 1, out MorePages);

Please suggest me, how to resolve this error.

Starting with a trace is always a good idea and using BL tester. I would recommend you spend some time learning these tools and perhaps search this forum for examples - there are a ton. Seems like the tools guide might also be a good place to start.

2 Likes

I am with dan, you should probably use GetByID instead and you must pass in all 5 key’s even if the other keys are unused, pass in blank strings. The Company value will be taken care of by the Session, you dont have to worry about it.

1 Like

Dear danbedwards, I have checked in BL tester. It is working fine refer to below screen

and same parameters we have passed in this method & not working in the script editor.

Don’t have my stuff with me, but from memory, the Getlist call on the Adapter requires 2 arguments (I think it’s a SearchOptions and MorePages). The BO call requires what you see in the BL Tester.

Get a decompiler (JustDecompile for exemple), and have a look in the code .

EDIT.

My answer with tools I mentioned was kind of general. if you want to make this really easy to see the method & parameters and even have Epicor generate the code for you then use the wizard. Then you are just making slight modifications to generated code. No need to de-comp for finding this.

image

1 Like

out MorePages is a boolean, which looks like you haven’t set, and won’t have “out” in it, that’t the type for the method, but you don’t use that when passing the parameters. (I don’t believe)

The parameters are completely wrong but he did set the morePages :slight_smile:

I guess I was looking for a true or false, just creating the bool with specifying the value doesn’t seem like very good practice to me, but maybe that’s industry standard?

The value (true or false) is returned from the method and not passed in.So all you are really doing is initializing the variable. The initialized value of “bool morePages;” would be false as uninitialized variables are not permitted in C#.

1 Like

good to know.

1 Like