Changing SNStatus on BPM

,

Hi everyone, I would like to create a BPM with BO Method that update field SNStatus on table SerialNo when table UD update, but can’t changes any field on SerialNo

If anyone has come across this before? If so how did you resolve it.
Thanks in advance for your help!

Erp.Contracts.SerialNoSvcContract SerialNo = null;
SerialNo = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SerialNoSvcContract>(Db);
string PartSer = “PART-TEST”;
string SerialNum = “PART-TEST12345”;
var dsSerialNo = SerialNo.GetByID(PartSer, SerialNum);
var SerialNo_xRow = (from SerialNo_Row in dsSerialNo.SerialNo
where SerialNo_Row.Company == Session.CompanyID
select SerialNo_Row).FirstOrDefault();
{
if(SerialNo_xRow != null)
{
SerialNo_xRow.SNStatus = “ADJUSTED”;
}
}

1 Like

Welcome to the group!

Did you do a trace and perform the desired transaction in the UI?

Thank you for the warm welcome!

Yes I did, the script that I used was the result of it, but when I tried it on bpm, it won’t update / change the SNStatus from SerialNo

The only reason I asked is that you’re using WCF services inside a BPM but BPMs give you access to all the tables right there. No need for C# code. The trace shows the exact methods called on the SerialNO BO and you can invoke those methods directly in the BPM.

ok, thanks for the advice, I’ll try it and give my update asap :grin:

And if you haven’t already, check out the Trace Helper that Josh and Jose created. It really helps with reading those trace files.

I would really advise against changing a system status field like that without performing the actual transaction that would normally cause the status change. Your example of changing the status to adjusted is normally what a quantity adjustment would do to a serialized item. Changing the SNStatus only would leave you with an on-hand qty with no associated Serial in inventory.

Hi Joseph, I know the consequences by changing the snstatus outside related transaction, and also got warning from epicor. But I have this requirement to update snstatus and to prevent any unwanted situation, I am changing two serial number, they are switching the snstatus and necessary information. Thank you for your advise Joseph!

Thank you for the tool, it helps me a lot

Just make sure you use the Business Object InventoryQtyAdj and you should be okay. It does more than just update SNStatus, it also updates PrevSNStatus and probably writes to SNTran Table.

SerialNo and SNTran table need to be updated. Occasionally I need to update it but through SQL. As long as you know the consequences, give it a try in test.