Rest Client in classic dashboard custom: "RestClientBuilder does not contain a definition for Function"

Hey all, this is strange - I’ve scoured the docs and this forum and haven’t found what I’m missing.

I’m on 2021.2.

This compiles without error but if I uncomment the line where I call the function, I get the error in the topic.

				var restClient = new RestClientBuilder();
				restClient.UseSession(this.oTrans.CoreSession);
				restClient.Build();
				
				var efxContent = new RestContent(
					new{
						strReqGroup = group,
					});
				
				//var efxResponse = restClient.Function.Post("FleetSolutions", "CreateGroup", efxContent, published: true);

Any thoughts? I’m fairly sure I have my references and usings correct.

Update, no go. I’ve removed and replaced the assembly reference to Epicor.Ice.Lib.RestClient.

At this point I’m considering @klincecum 's FunctionRunner idea, or maybe use RestSharp instead? I was hoping to keep it simple…

Is there any way to view what RestClientBuilder DOES have? Short of decompiling?

This looks correct to me. :thinking:

Decompiled and added what appear to be missing references:

image

“Build()” appears to build:

image

And what it builds appears to have “Function” although I’m kind of in new territory for a 90s script kiddie

image

And that, in turn, appears to do and have what I’d expect

but no change.

The whole error FWIW and FFS (“for future searches”, obviously; what were you thinking?) is:

" Error: CS1061 - line 166 (278) - ‘Ice.Lib.RestClient.RestClientBuilder’ does not contain a definition for ‘Function’ and no extension method ‘Function’ accepting a first argument of type ‘Ice.Lib.RestClient.RestClientBuilder’ could be found (are you missing a using directive or an assembly reference?)"

you need to assign the result of Build to your varible, not the builder itslef.

var restClient = new RestClientBuilder().
				UseSession(this.oTrans.CoreSession).
				Build();
1 Like

you have GOT to be kidding me :hugs::persevere::neutral_face::weary:

@Olga I know you get embarrassed when we call you a genius so I won’t say it, I’ll just say I’m an idiot and that should average it out.

Thank you THANK you thank you!

1 Like

Ok, I’ll just say that @Olga has great attention to detail then :wink:

2 Likes