Auto Assign Project ID with BPM in Epicor
If your company wants to streamline its project entry process, you can customize Epicor to auto-assign a project ID.
Step 1. Create a BPM method directive on the “GetNewProject” method belonging to the Project business object.
This should be a post-processing directive.
Step 2. Create a new action to execute ABL code.
/*Assign Project ID
When a new project is created, lookup Company.Number01 and increament it by 1.
Use that number as the new project ID. */define variable newNum as integer.
define variable newNumString as character.
for each ttProject where ttProject.RowMod = 'A' or ttProject.RowMod = 'U':
/* Lookup the Company that the Project is being created in */
find first Company exclusive-lock where Company.Company = ttProject.Company.
If available Company then do:
/* Increment project count by 1 */
assign newNum = Company.Number01 + 1.
/* Update Company.Number01 */
assign Company.Number01 = newNum.
/* Put the letter 'P' in front and pad with leading zeros */
assign newNumString = "P" + string(newNum,"999999").
assign ttProject.ProjectID = newNumString.
End. /* If */
End. /* For Each */
Step 3. Add the code to the ABL action screen.
Step 4. Enable the customization.
Step 5. Go to the Project Entry screen and create a new project. The ProjectID will be automatically generated.