If you want to have it trigger at a particular point in the process, you need to run a trace to ensure you know what Business Object/Method is being called. I believe it is Labor.StartProductionActivity if memory serves me correctly.
Here is example code I’ve used in the past:
def var vCSVFileName as character format 'x(128)'init '\\server\folder\myVendorFile.csv' no-undo .
FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ',' 'SupplierID' 'SupplierName' .
end.
for each Vendor no-lock where Vendor.Company = CUR-COMP and Vendor.GroupCode = 'SUB' by Vendor.VendorID .
export delimiter ',' 'SupplierID' 'SupplierName' .
export delimiter ',' Vendor.VendorID Vendor.Name .
end .
Thanks for the info , i have tired a number of business objects just to display a simple information message on screen from start production activity (So i know i have got the correct business object to use. But no luck!
My trace log attached suggests <GetNewLaborDtl would be the correct place or Labor.getrows TraceData6088.txt (104.2 KB)
Managed to get a trigger to work… but the code doesn’t export a csv file… i changed it to export a jobnum and partnum for jobhead table hoping this would export the current selected working on job info.
def var vCSVFileName as character format 'x(128)'init ‘\ERP01\temp\myVendorFile.csv’ no-undo .
FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ‘,’ ‘JobHead’ ‘PartNum’ .
end.
for each JobHead no-lock where JobHead.Company = CUR-COMP and Jobhead.PartNum = ‘SUB’ by JobHead.JobNum .
export delimiter ‘,’ ‘JobNum’ ‘PartNum’ .
export delimiter ‘,’ JobHead.JobNum JobHead.PartNum .
end .
Is that location a folder or is ERP01 the server? I think you had a bunch of typos:
def var vCSVFileName as character format 'x(128)' init '\\ERP01\temp\myVendorFile.csv' no-undo .
FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ',' 'JobHead' 'PartNum' .
end.
for each JobHead no-lock where JobHead.Company = CUR-COMP and Jobhead.PartNum = 'SUB' by JobHead.JobNum .
export delimiter ‘,’ ‘JobNum’ ‘PartNum’ .
export delimiter ‘,’ JobHead.JobNum JobHead.PartNum .
end .
Yes it will need the server name as i want to have the csv file in shared location.
The code just needs to output the selected job that the mes users is about to working on, when start activity is press then the csv file exports jobhead.jobnum, jobhead. partnum, part.prodcode and a few other fields from the part table.
def var vCSVFileName as character format 'x(128)'init ‘C:\temp\myVendorFile.csv’ no-undo .
FILE-INFO:FILE-NAME = vCSVFileName .
if FILE-INFO:FILE-SIZE < 24 then do:
export delimiter ‘,’ ‘EmployeeNum’ .
end.
for each ttLaborHed where ttlaborhed.RowMod = ‘A’:
find first laborhed where laborhed.Company = ‘MSIUK’ AND
laborhed.EmployeeNum = string (ttlaborhed.EmployeeNum) .