Hi - I found this post and found it extremely helpful! Itās in a slightly different context - when a Receipt Line is marked Received and the associated āIssued Completeā checkbox for a Job subcontract is checked, we want to trigger a BPM to do a Subcontract adjustment forcing the operation to be marked complete.
I was able to get the Syntax to checkout, but I am getting a compiler error - any ideas on a workaround?
I have a Post Processing Method Directive on Erp.BO.Receipt.OnChangeDtlReceived.
Condition: The ttRcvDtl.IssuedComplete field of the changed row is equal to the true expression.
When true, set the following Variables:
MyJobNum: String ā Set to ttRcvDtlRow.JobNum
MyAssySeq: Integer ā Set to ttRcvDtlRow.AssemblySeq
MyOprSeq: Integer ā Set to ttRcvDtlRow.JobSeq
MyCompany: String ā Set to ttRcvHeadRow.Company
Then Execute the following Custom Code:
References: Erp.Contracts.BO.JobAdjustment
Usings:
using Erp.Tablesets;
using Erp.Proxy.BO;
using Erp.Contracts;
using Erp.BO;
Code:
// Create Job Adjustment Tableset for Labor and connect to service contract
JobAdjustmentTableset MyTs = new JobAdjustmentTableset();
var MyJobAdj =Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobAdjustmentSvcContract>(Db);
// Populate Labor Detail record
MyTs.JALaborDtl.Add(new JALaborDtlRow());
MyTs.JALaborDtl[0].ClockInDate = DateTime.Now;
MyTs.JALaborDtl[0].LaborNote = āAuto Completedā;
MyTs.JALaborDtl[0].AssemblySeq = MyAssySeq;
MyTs.JALaborDtl[0].OprSeq = MyOprSeq;
MyTs.JALaborDtl[0].QtyCompleted = 0;
MyTs.JALaborDtl[0].ActProdHours = 0;
MyTs.JALaborDtl[0].ActSetupHours = 0;
MyTs.JALaborDtl[0].ActBurCost = 0;
MyTs.JALaborDtl[0].ActLabCost = 0;
MyTs.JALaborDtl[0].EmployeeNum = string.Empty;
MyTs.JALaborDtl[0].EmployeeName = string.Empty;
MyTs.JALaborDtl[0].LaborQty = 0;
MyTs.JALaborDtl[0].LaborType = āPā;
MyTs.JALaborDtl[0].LaborHrs = 0;
MyTs.JALaborDtl[0].LaborCost = 0;
MyTs.JALaborDtl[0].BurdenHrs = 0;
MyTs.JALaborDtl[0].BurdenCost = 0;
MyTs.JALaborDtl[0].Complete = true;
MyTs.JALaborDtl[0].OpComplete = true;
MyTs.JALaborDtl[0].company = MyCompany;
MyTs.JALaborDtl[0].LaborHedSeq = 1;
MyTs.JALaborDtl[0].LaborDtlSeq = 1;
MyTs.JALaborDtl[0].OpCode = string.Empty;
MyTs.JALaborDtl[0].ResourceGrpID = string.Empty;
MyTs.JALaborDtl[0].JcDept = string.Empty;
MyTs.JALaborDtl[0].JobNum = MyJobNum;
MyTs.JALaborDtl[0].SysRowID = new Guid();
MyTs.JALaborDtl[0].RowMod = āAā;
string legalNumberMessage = string.Empty;
// Commit Labor record
MyJobAdj.CommitSubcontractAdj(ref MyTs, out legalNumberMessage);
Issue:
Using the Check Syntax button, this comes back as ok. But when I go to save the directive, I get the following error:
Error:
System Information
==================
AppServer Connection: https://SV-APP-01.projectsinc.local/EpicorTest
Form Name: Method Directives
Customization Name:
Menu ID: BPMN1200
Software Version: 3.2.700.0
============
Server Side Exception
There is at least one compilation error.
OnChangeDtlReceived.CommonTypes.cs(256,33): error CS0433: The type āLegalNumGenOptsTableā exists in both āErp.Contracts.BO.JobAdjustment, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992ā and āErp.Contracts.BO.Receipt, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992ā
Exception caught in: Epicor.ServiceModel
Error Detail
============
##!Correlation ID:##! 29f21457-8ddd-4245-b69a-920f44f96da0
##!Description:##! There is at least one compilation error.
##!Details:##!
OnChangeDtlReceived.CommonTypes.cs(256,33): error CS0433: The type āLegalNumGenOptsTableā exists in both āErp.Contracts.BO.JobAdjustment, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992ā and āErp.Contracts.BO.Receipt, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992ā
##!Program:##! Epicor.Customization.Core.dll
##!Method:##! Compile
##!Line Number:##! 78
##!Column Number:##! 13
Client Stack Trace
==================
at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
at Ice.Proxy.BO.BpMethodImpl.Update(BpMethodDataSet ds)
at Ice.Adapters.BpMethodAdapter.OnUpdate()
at Ice.Lib.Framework.EpiBaseAdapter.Update()
at Ice.UI.App.BpMethodEntry.Transactions.MainTransactionBase.adapterUpdate()
Is there a way to work around this error? I am having trouble.