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 / SQL_Get_Default_MobileSiteMap.sql
Last active May 23, 2022 19:53
SQL Script - Get Default Mobile Site Map
/* NOTE: Replace [2022R1] with the name of YOUR database */
/* Right-Click the Table in MS SQL Server Mgmt Studio and select "Select Top 1000 Rows" */
SELECT TOP (1000) [CompanyID]
,[ScreenID]
,[Script]
,[Type]
,[CompanyMask]
,[CreatedByID]
,[CreatedByScreenID]
@BrianMRO
BrianMRO / IsAutoRun.cs
Last active April 28, 2022 16:24
IsAutoRun
.WithFlowStates(states =>
{
states
.Update<State.approved>(flowState => flowState
.WithActions(actions =>
{
actions.Update(g => g.pushInventoryID, a => a.IsAutoAction(conditions.MyCondition));
}));
})
@BrianMRO
BrianMRO / Workflow_Disable_Hide_Actions.cs
Last active March 3, 2022 15:22
Workflow - Disable or Hide Actions
#region Actions - Hide (Pre-Defined Action)
screen
.WithActions(action =>
{
action.Add(removeHold);
action.Add(putOnHold);
action.Add(complete);
action.Add(reopen);
action.Add(g => g.schedule, a => a
.WithCategory(processingCategory)
@BrianMRO
BrianMRO / Workflow_Blog_Post_4.cs
Last active March 3, 2022 15:16
Workflow - Blog Part 4
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_Conditions_On_Transitions.cs
Created March 2, 2022 22:16
Workflow - Conditions on Transitions
.WithTransitions(transitions =>
{
transitions.AddGroupFrom(State.InitialState, ts =>
{
ts.Add(t => t
.To<State.hold>()
.IsTriggeredOn(g => g.initializeState)
.When(conditions.IsOnHold)); // CONDITION!!!
});
transitions.Add(transition => transition
@BrianMRO
BrianMRO / Workflow_Using_Conditions
Created March 2, 2022 22:07
Workflow - Using Conditions
.When(conditions.IsOnHold)
@BrianMRO
BrianMRO / Workflow_Define_Conditions.cs
Last active March 3, 2022 15:24
Workflow - Define Conditions
#region Conditions
Condition Bql<T>() where T : IBqlUnary, new() => context.Conditions.FromBql<T>();
var conditions = new
{
IsOnHold
= Bql<hold.IsEqual<True>>(),
IsScheduled
= Bql<scheduleDate.IsNotNull>(),
}.AutoNameConditions();
@BrianMRO
BrianMRO / Workflow_Prerequisite_for_Conditions.cs
Created March 2, 2022 21:12
Workflow - Prerequisite for Conditions
using static PX.Data.WorkflowAPI.BoundedTo<CMMSWorkOrderEntry, CMMSWorkOrder>;
@BrianMRO
BrianMRO / Workflow_Blog_Post_3.cs
Last active March 2, 2022 17:01
Workflow - Blog Part 3
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_Adding_Transitions.cs
Created March 2, 2022 16:33
Workflow - Adding Transitions
transitions.AddGroupFrom(State.InitialState, ts =>
{
ts.Add(t => t
.To<State.hold>()
.IsTriggeredOn(g => g.initializeState));
});
transitions.Add(transition => transition
.From<State.hold>()
.To<State.open>()
.IsTriggeredOn(removeHold)