oTrans Reference

I was curious regarding the oTrans object. I’ve research and found that it contains quite a bit of data for the current session but I’m unable to access this and get a null reference error. I’ve tried skimming documentation and EpiUsers trying to find out what this is but i’ve been butting up against a few customizations that I need to refresh the dataview or update a field on the view and it seems that this oTrans object is my key to it all.

Any advice? We are running SaaS. Does E10 have more customization features that using the cloud? Is there things to watch for as i’m going through EpiUsers trying to find guidance?

You should share exactly what you’re trying to do and any code you have (if you’ve gotten to that point, which it sounds like you have). I am sure you’ll get the help you need with a more specific question :slight_smile:

1 Like

Firstly, thank you for your response!

Sure, what brought this up is when we receive parts, the system throws it into the company default bin until the warehouse employee hits “Set to Location” button and it wipes the bin number away and then throws an error. I was on here looking for others with a similar issue and saw somebody had written a BPM on the BO.

this link details what I was reading and formed my thought process. I’m getting a bunch of complaints from warehouse management and the warehouse team that they don’t have the bins memorized and they want the system to populate this value automatically. I’m having the same issue except with the PUR-STK items.

My code :
BO: Erp.BO.Receipt.AutoSetToLocationToDflt
Post-Processing

var RcptHead = ds.RcvHead.Where(x => x.Company == Session.CompanyID).FirstOrDefault();

if (RcptHead != null)
{

  var RcvLines = ds.RcvDtl.Where(dtl => dtl.PONum == RcptHead.PONum && dtl.Company == Session.CompanyID).AsEnumerable();
  
  if (RcvLines != null)
  {
  
    foreach (var dtl in RcvLines)
    {
    
      if (dtl.TranType == "PUR-STK")
      {
      
        var Bin = this.Db.PartBinInfo.Where(pt => pt.PartNum == dtl.PartNum && pt.WarehouseCode == dtl.WareHouseCode).FirstOrDefault();
        
        //dtl.BinNum = Bin.BinNum;
        var view = DataView["Mass Receipts"];
        
        
      }
    
    }
    
      this.Db.Validate();
      this.Db.SaveChanges();
  
  }

}

image


Before ‘Set All To Location’


After ‘Set All To Location’

image
Part Bin Information that I would like to see populated in the field.

I have all the information stored on the Bin information tab within the part record. I pull that data at the Bin variable and attempt to set it to the view as this is event doesn’t submit the values rather validates.

With that being what I’m trying to accomplish, I don’t think setting the BinNum through the RcvDtl.BinNum won’t work as it isn’t submitting the data, correct? it’s wiping the value and throwing an error that there must be a value. I found through a post where Jose was setting fields using the oTran object but I get a reference error everytime I try to utilize that object. Maybe this isn’t the best way to go about it but I wanted to default an option but also give them the choice to change it if they can’t fit it properly in the bin or if it’s a one-off case. In Jose’s post, he was using oTran to pull in the DataView and programmatically apply values.

(one source used)

We are fairly new to Epicor and I’m still trying to find my footing in the platform, is oTran something that’s only available to on-prem customers? Is that equivalent to our Session variable?

When you’re working with BPMs those are all executing server side and not on the client. oTrans object is present in the client to facilitate transactions. What I’m not is an expert in Kinetic and how their client (if you can call it that) applications work in comparison to the traditional E10 client, but there are lots of smart people here who are.
In a BPM, you do have access to a Session object to give you information regarding the session, but in this case, I don’t think you need it.
I have a post processing BPM that does something similar where I set/override a company defaulted “To Bin” if a part is from a certain supplier.
I used widgets (embrace the widgets when you can) to do so like this:

I created a BPM variable “vendorBin” to store my value that I’ll set based on a condition:

Conditional block to evaluate my logic:

if true, use widget to set field to my preferred value; if false, set to my default value


Then both paths route to a special widget called update table by query, which is a fancy way of saying alter a tableset in a BPM

I create my “query” which ties my ttRcvDtl BPM temp table to the PORelease table (where I am pulling my vendor value from) and limit my PORel table to the BPM parameter value of poNum.
In the “display”, I am retrieving a custom field on PORel to then use in my BPM (not applicable to your case I am sure, but just trying to explain).

Next, I set my “Use the {query} query to update the {row types} of the {table} with the {configured} mapping” values to the added rows in the ttRcvDtl table (which is populating the UI in the your receipt form). In my configured mapping, I then set only the fields I want to change in there like so:

Configured Mapping:
Changes:
BinNum to my vendorBin variable value
OurQty to 1 (probably not applicable to you)
VendorQty to 1
ReceivedComplete to true
LotNum to my query “display” value of PORel_LotNum_c
InputOurQty to 1
ThisTransQty to 1


Knowing which fields to set is a skill unto itself but this then sets the added rows of ttRcvDtl values to this mapping after the method executes. I found this is what changes the values in the Mass Receipt form and it works great.

That’s a long way of saying you don’t need to worry about the oTrans object when you’re working with BPMs and that only really applies when you’re working with form customization.

For some reason, the Update Table by Query, Fill Table by Query, and Set by Query all confuse me. I’m not sure of their use cases are. We use the Mass Receipts entry screen to receive parts, would widget loop through each record with that logic or would it only apply it once? We could have 20 different parts being received on a single PO (if you noticed the loop in the code) and Maybe I was again confusing myself because there isn’t a like a while widget that you can give the parameters/loop count and have it perform logic that way.

What do you mean by Form Customization? I had mentioned that I have a few things that i’m working on. One of the other things is this:

I have gotten this to work successfully but I need to refresh the page so the values will appear. Currently it runs in a split second and then nothing else happens. I’d like to get the tree to update with green check marks as well as the date appearing in the top page. The only way I can accomplish this currently is to use the ellipses and click refresh in the view by hand. I was messing with events in Application Studio (AS) but there seems to be an update to AS that doesn’t match up with what has been posted before. I was trying to use the Console.Write event and use Location.Refresh(); but it didn’t have an expression box.

Would this be an oTran thing? Am I thinking too broad on ‘Customization’?

Looping in widgets is indeed a pain point as many can attest to. If you truly need a loop, I recommend code. The widget naming is also confusing, I can empathize.
Do you have access to the Epicor Customization guide? I would definitely start there for a lot of these questions.
I’m not on Kinetic, but form customization vs. BPM customization are still two distinct things.

1 Like

I should have access and if I don’t, I can get it. Could you point me in the direction of the Guide?

Yes for sure. It should be on the EpicWeb website (you should have a login but contact your CAM if you don’t or need help getting in).
There are usually 2 major guides; 1 for customization (i.e. forms) and 1 for ICE tools, which includes BAQs and BPMs. I’d really recommend reading those.

2 Likes