I am trying to implement the new action definitions on a custom screen in 2020R1 in preparation for 2021R2. I cant seem to get these actions to group into folders, and the last action will not hide. What am I missing?
This is in the graph definition:
public override void Configure(PXScreenConfiguration graph)
{
var context = graph.GetScreenConfigurationContext<NGBiopsyEntry, NGBiopsy>();
context.AddScreenConfigurationFor(screenConfig =>
screenConfig
.WithActions(actions =>
{
actions.Add(a=>a.ActionSubmitBiopsy);
actions.Add(a=>a.ActionRefreshWorkTickets,
config=>config
.InFolder(FolderType.ActionsFolder));
actions.Add(a=>a.ActionStartPGTMTesting,
config=>config
.InFolder(FolderType.ActionsFolder));
actions.Add(a=>a.ActionSetEmbryoIDGen,
config=>config
.InFolder(FolderType.ActionsFolder)
.IsHiddenAlways());
}));
}
But still I get this:
Even after restarting the application, rebuilding the dll, publishing the customization project. Is there another setting I Am missing?
The new workflow is pretty entertaining to sort out. There was a great presentation at Summit this year, so keep an eye out for when the post the video to get a lot of great additional detail. This should be a pretty easy fix, but it isn't universal so I'll share the 2 ways you might have to add your menu actions.
The first thing that got my attention is that your menu actions are not in the Actions folder as you specified. That's a pretty clear sign that the context isn't quite right. I break mine into 2 parts, and I think you set yours with a single method.
In both cases, you need to start by overriding Configure, specifying the graph and primary DAC. Then you define a Configure using your WorkflowContext specific (again) to your graph and primary DAC. After that, things start to become a little more complicated.
Is this for a new custom screen that has no screen configuration yet, or are you extending a workflow that already exists? In the first example, I am adding a couple of print actions to the POReceiptEntry graph which already has a workflow (and screen configuration) defined. Also, I'm adding my action from the POReceiptEntry_Extension class, so I need to specify that on the Add.
public override void Configure(PXScreenConfiguration config)
=> Configure(config.GetScreenConfigurationContext<POReceiptEntry, POReceipt>());
protected virtual void Configure(WorkflowContext<POReceiptEntry, POReceipt> context)
{
context.UpdateScreenConfigurationFor(screen =>
{
return screen
.WithActions(actions =>
{
actions.Add<POReceiptEntry_Extension>(
g => g.printItemLabel,
a => a.InFolder(FolderType.ActionsFolder)
);
actions.Add<POReceiptEntry_Extension>(
g => g.printSOLabel,
a => a.InFolder(FolderType.ActionsFolder)
);
});
});
}
When adding an action to a custom screen, the screen configuration is not created until you create it. In this example, you will see UpdateScreenConfigurationFor is changed to AddScreenConfigurationFor. Also, you will see that Add does not specify the extension this time because the actions are defined in my custom (base) graph.
public override void Configure(PXScreenConfiguration config)
=> Configure(config.GetScreenConfigurationContext<MyGraph, MyDAC>());
protected virtual void Configure(WorkflowContext<MyGraph, MyDAC> context)
{
context.AddScreenConfigurationFor(screen =>
{
return screen
.WithActions(actions =>
{
actions.Add(
g => g.myAction,
a => a.InFolder(FolderType.ActionsFolder)
);
});
});
}
Notes to other readers:
I'm using 2021R1, and for everyone else's benefit, I've talked with Kyle and learned he is using 2020R1. His specific implementation is a bit more complex, and he needed to add
.AddDefaultFlow(workflow => workflow...
to create his default workflow. This can be done in the screen definition as well from the screen editor in the customization project, although I cannot recall if our SysAdmin did that or if AddScreenConfiguration in my example handled it for me.