Skip to content

Instantly share code, notes, and snippets.

View BrianMRO's full-sized avatar

Brian Stevens BrianMRO

  • SETECH Supply Chain Solutions, LLC
View GitHub Profile
@BrianMRO
BrianMRO / Workflow_Assign_Actions_to_States
Created March 2, 2022 16:23
Workflow - Assign Actions to States
states.Add<State.hold>(flowState => flowState
.WithActions(actions =>
{
actions.Add(removeHold, a => a.IsDuplicatedInToolbar());
}));
@BrianMRO
BrianMRO / Workflow_Control_Fields.cs
Last active March 2, 2022 16:22
Workflow - Control Fields
states.Add<State.hold>(flowState => flowState
.WithActions(actions =>
{
actions.Add(removeHold, a => a.IsDuplicatedInToolbar());
})
.WithFieldStates(fields =>
{
fields.AddAllFields<CMMSWorkOrder>();
fields.AddField<hold>(c => c.IsHidden());
}));
@BrianMRO
BrianMRO / Workflow_Blog_Post_2.cs
Created February 28, 2022 21:24
Workflow - Blog Part 2
using PX.Data;
using PX.Data.WorkflowAPI;
using PX.Objects.Common;
namespace Blog.CMMS
{
using static PX.Data.WorkflowAPI.BoundedTo<CMMSWorkOrderEntry, CMMSWorkOrder>;
using static CMMSWorkOrder;
using State = Blog.CMMS.CMMSWorkOrder.Statuses;
@BrianMRO
BrianMRO / Workflow_Add_Action_To_Menu.cs
Last active February 28, 2022 21:23
Workflow - Add Action to Menu
#region Add Actions to the Menus
screen
.WithActions(action =>
{
action.Add(removeHold);
action.Add(putOnHold);
action.Add(g => g.schedule, a => a
.WithCategory(processingCategory)
);
});
@BrianMRO
BrianMRO / Workflow_Define_Actions_2021R2.cs
Last active February 28, 2022 20:21
Workflow - Define Actions (2021 R2)
#region Categories
var processingCategory = CommonActionCategories.Get(context).Processing;
#endregion
#region Define Constants
private const string
_actionRemoveHold = "Remove Hold",
_actionPutOnHold = "Hold";
#endregion
@BrianMRO
BrianMRO / Workflow_Define_Actions.cs
Created February 28, 2022 20:04
Workflow - Define Actions
// Define Constants
private const string
_actionRemoveHold = "Remove Hold",
_actionPutOnHold = "Hold";
#region Actions
var removeHold = context.ActionDefinitions
.CreateNew(_actionRemoveHold, a => a
.InFolder(FolderType.ActionsFolder)
.PlaceAfter(g => g.Last)
@BrianMRO
BrianMRO / Workflow_Basic_Shell.cs
Created February 28, 2022 15:32
Workflow - Basic Shell
using PX.Data;
using PX.Data.WorkflowAPI;
using PX.Objects.Common;
namespace Blog.CMMS
{
using static PX.Data.WorkflowAPI.BoundedTo<CMMSWorkOrderEntry, CMMSWorkOrder>;
using static CMMSWorkOrder;
using State = Blog.CMMS.CMMSWorkOrder.Statuses;
@BrianMRO
BrianMRO / Workflow_InitializeState.cs
Created February 28, 2022 15:17
Workflow - Initialize State Actions
#region initializeState
public PXAutoAction<CMMSWorkOrder> initializeState;
#endregion
@BrianMRO
BrianMRO / Workflow_Statuses_Example.cs
Created February 28, 2022 14:57
Workflow - Statuses Example
public static class Statuses
{
public class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(
new[]
{
Pair(Hold, PX.Objects.EP.Messages.Hold),
Pair(Open, PX.Objects.EP.Messages.Open),
Pair(Complete, PX.Objects.EP.Messages.Complete),
@BrianMRO
BrianMRO / RefreshSmartPanelGrid.aspx
Created February 15, 2022 17:20
Make Smart Panel Grid refresh on open
<px:PXSmartPanel
runat="server"
ID="PnlSSCSHistory"
CommandSourceID="ds"
Caption="History"
CaptionVisible="True"
Height="400px"
Width="800px"
LoadOnDemand="true"
Key="History"