Customize "Duplicate Project" window

We have a BPM in Project Entry that sets the Project ID field to “NextPrID” and then generates the next sequential Project ID from user codes. It works great, until someone decides to use the Actions - Duplicate Project." When this window comes up, the “New Project ID” field is blank, and I cannot figure out how to populate this with the text “NextPrID.”

Things I’ve tried:

  1. Typing in a value in the “Text” field on the Properties tab in the Data section. When I reload the customization that value is cleared out again.

  2. Looked into BPMs but it appears that no methods fire when the duplicate project window opens.

  3. Screen customization. Using Form Event Wizard, Event Type: EpiViewNotification, Views: NoBoundField Found the following code snippet:
    EpiDataView edvPJ = (EpiDataView)oTrans.EpiDataViews[“NoBoundField”];(edvPJ.dataView[edvPJ.Row][“ProjectID”]) = “NextPrID”;
    This code compiles successfully but does not populate the Project ID field with “NextPrID”

Has anyone successfully accomplished this?

For #1 - did you create a Process Call for that form/customization so it loads when called?

I did not do a process call, but I believe the form is loading the customization. I tested this by resizing one of the text fields. When I select Actions - Duplicate Project, the form opens with the change.

Alright, try this on FormLoad

EpiDataView edvPJ = (EpiDataView)oTrans.EpiDataViews[“NoBoundField”];(edvPJ.dataView[edvPJ.Row[“ProjectID”]) = “NextPrID”;
edvPJ.Notify(new EpiNotifyArgs(edvPJ,0,EpiTransaction.NotifyType.AddRow));

Hi Chris,
Thanks, this worked to set “NextPrID” in the Duplicate Project Window. However, when I click OK on that window, the BPM that I have does not fire, so the Project gets created with an ID of “NextPrID” instead of the next sequential number.

The BPM is currently on the Project.Update method, which apparently doesn’t fire when a project is duplicated. I tried replicating the BPM and adding it to the Project.DuplicateProject method, but that did not work.

Do you know of a way that I can force the Project.Update method to fire? Or do you have other suggestions to accomplish this in the Duplicate Project form customization?

Thanks,
Hannah

Ok I think I am getting really close to making this work, hoping someone can help get me the rest of the way there.

I have a pre-processing BPM on the Project.DuplicateProject method:

Ice.Tables.UDCodes UDCodes = new Ice.Tables.UDCodes();
{
foreach (var UD in (from C in Db.UDCodes
where (string.Compare(targetProjectID, C.CodeID, true) == 0)
select C))
{
targetProjectID = System.Convert.ToString(Convert.ToInt32(UD[“Number01”]));
UD[“Number01”] = (decimal)UD[“Number01”] + 1;
}
}

When I click Actions - Duplicate Project, the duplicate project window comes up with “NextPrID” in the window (from the screen customization).

My UDCodeID updates correctly and increments by 1.
My new Project with the next sequential number is created behind the scenes.

However, the “Source Project” remains on display. How do I make it so that the new Project pulls up instead?

Any ideas?

Not sure - my epicor loads the duplicated project immediately. Are you sure it is duplicating?

Hi Chris,
Yes, it is duplicating. I included a word doc with screenshots to demonstrate. When I do a trace it looks like it runs the DuplicateProject method and then the GetByID method, but the ProjectID value in GetByID is the sourceProjectID, not the targetProjectID

DuplicateProjectIssue.docx (242.6 KB)