Visual Studio & Material Issue & REST

Tracy did you write this originally? There’s very little difference between the calls in WCF and the Calls in Rest in fact you can call the exact same Methods you just have to use new syntax which is outlined in the Nuget Documentation and several of us have provided examples.

In your WCF Call you invoke GetNewJobAsmblMultiple as such

DataRow dr = selJobAsmDs.SelectedJobAsmbl.NewRow();
        dr["Company"] = "COMP01";
        dr["JobNum"] = jobNum;
        dr["AssemblySeq"] = asmSeq;
        selJobAsmDs.SelectedJobAsmbl.Rows.Add(dr);
issueReturnDs = irBO.GetNewJobAsmblMultiple("STK-MTL", emptyGuid, "IssueMaterial", selJobAsmDs, out message);

If you follow the documentation you will know that you can make that same exact call via EpicorRest.BoPost something like

/*
The payload for rest call is usually (unless you want to make a class) an anonymous 
object which needs to conform to the same requirements as the WCF Call above 
so in this case you'd re-create an object that includes the fields in the 
above GetNewJobAsmblMultipleCall something like */

var postData = new {
  "pcTranType": "STK-MTL",
  "pcMtlQueueRowID": Guid.Empty(),
  "pCallProcess": "IssueMaterial",
  "ds": {
    "SelectedJobAsmbl": [
      {
        "Company": "COMP01",
        "JobNum": jobNum,
        "AssemblySeq": asmSeq,
        "RowMod": "A"
      }
    }
};

var result = EpicorRest.BoPost("Erp.BO.IssueReturnSvc","GetNewJobAsmblMultiple", postData)

That result would be the same result you’d get out of the above WCF call, and you then would do the same with the next BO call etc.

What part are you struggling with?

4 Likes

Thanks Jose,

I am working through it again now to try and build it up the way you have put it above, I am not a developer, the developer that wrote the wcf version has left so myself and my colleague are trying our best to replicate what the wcf project was doing but effectively we are learning from scratch and timescales are tight to go live on Kinetic.

We appreciate all the help we are getting

not to put too fine a point on it but just converting the code is half of the battle if you aren’t a developer and don’t fully understand what the original person did or what needs to be done now, and neither does your colleague this would be a good opportunity to get some help from an outside consultant or partner to get you over the hump.

Generally it is not a good idea to put code in production that you do not fully understand you could end up with a half working solution at best and at worst with corrupted incorrect data.

Most companies aren’t too keen on spending money, but the alternative could be much worse. I’m not trying to offend you I’m sure given enough time and resources you could figure it out and do a good job. But if you are up against a deadline I would recommend you bring someone skilled in.

There are some wonderful folks around these folks that can help and we have some wonderful independent and partner consultants that lurk around too.

4 Likes

If there are just a few errors it might be a simple fix like one of the BO’s signature changed. If it can be simply resolved, then you could use the WCF code which is already proven while you take your time and carefully learn and test a REST based solution.

Otherwise you might either want to get help or put off your upgrade. Its better to do things right than to rush.

1 Like

200w.gif ?cid=6c09b952x0pl4sx4zlnozb8kt0e4isxezsdq8tc1le98i20o&ep=v1_gifs_search&rid=200w. gif&ct=g

1 Like

Won’t really help any if understanding what Bo’s need to be called and why, and what they take is the part giving them trouble… Plus they still would need to parse the files and send the data up via rest…

Yes you still need to know the BO’s to be called, but this is just a case of doing the issue whilst in trace mode.

The trace log will tell you what you need to know.

The great thing about functions using widgets is it all very intuitive and doesn’t require lots of custom code.and you can build the function, using the trace file as a blueprint.

Then there is security, not having to expose all the BO to a Rest login using Access Scope is really useful.

Functions, every time for me.

4 Likes

I have added my first BO to the project (IssueReturn > GetNewJobAsmblMultiple) and the response is now populating with a ‘return object - IssueReturn’ as shown below

I have multiple BO’s I need to run, how do I populate these fields from the next business objects i call?

(Sorry guys - I am still trying!)

The process is the same, you make a Rest call, get results, update the object make the next call… Repeat
See this example below,

  1. Make Data set
  2. Call BO
  3. Check Result is ok
  4. Make the next data set using part of the result I received.
    Go to Step 2 Repeat

I hate to sound like a broken record but if you need someone to do it for you, you should seriously consider bringing in a partner or a consultant. Most of us love to help when we can, but we have no time to flesh out entire solutions

1 Like

Sorry I didn’t remember this sooner, but I had posted an Epicor Function for Issue and Return Material a while ago.

https://www.epiusers.help/t/epicor-function-to-issue-and-return-material/93575

This gets used here daily in an integration.

You might be biting off just enough to chew on if you just start with this and use your VS code to call it.

Also… are you really on E10? That’s what your profile says. If you said different somewhere in the previous 48 posts, I have forgotten. Point is, I don’t recall what version that EFx library is from.

1 Like

Thanks Jason, I will take a look :slight_smile:

We are on E10 but have a working solution for that, we are in the process of upgrading to Kinetic 2023.2 which is what we need the working solution for

Hi Jason,
I have got the function to work in REST however when i look at the material transaction against the job it doesn’t seem to be posting to the GL, is this something you have noticed?

I’m going to ask what may be obvious, but, have you run Capture COS/WIP? No part transactions post until then.

But otherwise, no we have not had any problems.