Skip to main content
Answer

How can I replace the default Case Workflow via code?

  • April 27, 2022
  • 2 replies
  • 360 views

darylbowman
Captain II
Forum|alt.badge.img+15

I am attempting to completely replace the default Case Workflow via code.

 

I copied nearly the entire default CaseWorkflow code and customized it to my liking. However, I am not able to make the changes display in any way.

 

Some important bits of code are:

namespace CaseTest
{
using static PX.Data.WorkflowAPI.BoundedTo<CRCaseMaint, CRCase>;

public class CaseWorkflow_CRCaseMaint_Workflow : PXGraphExtension<CRCaseMaint>
{
public static bool IsActive() => true;

public override void Configure(PXScreenConfiguration config)
{PXTrace.WriteInformation("!");
var context = config.GetScreenConfigurationContext<CRCaseMaint, CRCase>();

context.ReplaceScreenConfigurationFor(screen =>
{
return screen
.StateIdentifierIs<CRCase.status>()
.FlowTypeIdentifierIs<CRCase.caseClassID>(true)
.WithFlows(flows =>
{
flows.AddDefault(DefaultCaseFlow);
})
// ....

 And the customized workflow:


Workflow.IConfigured DefaultCaseFlow(Workflow.INeedStatesFlow flow)
{
//....

 

Can anyone see any issues here? I attached the whole code file just in case someone wants to work through it. Just rename the file extension to .cs and it will open in Visual Studio.

Best answer by darylbowman

My issue was trying to create an extension of CRCaseMaint instead of PX.Objects.CR.Workflows.CaseWorkflow, which is already an extension of CRCaseMaint. Therefore, I needed this:

public class CaseWorkflow_CRCaseMaint_WorkflowExt : PXGraphExtension<PX.Objects.CR.Workflows.CaseWorkflow, CRCaseMaint>
{

 

2 replies

darylbowman
Captain II
Forum|alt.badge.img+15
  • Author
  • Answer
  • April 28, 2022

My issue was trying to create an extension of CRCaseMaint instead of PX.Objects.CR.Workflows.CaseWorkflow, which is already an extension of CRCaseMaint. Therefore, I needed this:

public class CaseWorkflow_CRCaseMaint_WorkflowExt : PXGraphExtension<PX.Objects.CR.Workflows.CaseWorkflow, CRCaseMaint>
{

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • April 28, 2022

Thank you for sharing your solution @darylbowman !