Solved

How can I replace the default Case Workflow via code?

  • 27 April 2022
  • 2 replies
  • 208 views

Badge +11

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.

icon

Best answer by darylbowman 28 April 2022, 22:17

View original

2 replies

Badge +11

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>
{

 

Userlevel 7
Badge

Thank you for sharing your solution @darylbowman !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved