Skip to main content
Solved

Add Custom Object to Workflow Engine

  • 20 April 2023
  • 2 replies
  • 86 views

Hello,

I am currently going through training, trying to generate a custom object and have it be able to be interfaced via the workflow engine ui. However, when I attempt to add a field to the “State Identifier” field on the workflow interface, it does not return any available values. I plan to debug.. but figured I would put this on the community to see if there is something that immediately jumps out that I’m doing wrong.  Thanks in advance, code snippet for DAC and Graph below.

Note: I realize that I’m taking a shortcut by not creating a helper class for the status values (perhaps to my detriment).. figured I would give it a shot before I go the effort to build out entirely.

If I were to guess at what the problem is, I’m either not decorating the DAC or field with an attribute to signal to the engine that its a valid field to build the workflow off of. I’m trying to get away from having to code the workflow by hand.

DAC:

using System;
using PX.Data;

namespace BlyTestObject
{
bSerializable]
zPXCacheName("BlyTestObject")]
public class BlyTestObject : IBqlTable
{
#region Trxnid
xPXDBIdentity(IsKey = true)]
public virtual int? Trxnid { get; set; }
public abstract class trxnid : PX.Data.BQL.BqlInt.Field<trxnid> { }
#endregion

#region Status
aPXDBString(1, IsFixed = true, InputMask = "")]
"PXIntList(new intn] {0, 1, 2, 3}, new string3] {"On Hold", "Draft", "Open", "Closed"})]
"PXUIField(DisplayName = "Status")]
public virtual string Status { get; set; }
public abstract class status : PX.Data.BQL.BqlString.Field<status> { }
#endregion

#region CreatedDateTime
TPXDBCreatedDateTime()]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : PX.Data.BQL.BqlDateTime.Field<createdDateTime> { }
#endregion

#region CreatedByID
BPXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID> { }
#endregion

#region CreatedByScreenID
ePXDBCreatedByScreenID()]
public virtual string CreatedByScreenID { get; set; }
public abstract class createdByScreenID : PX.Data.BQL.BqlString.Field<createdByScreenID> { }
#endregion

#region LastModifiedDateTime
TPXDBLastModifiedDateTime()]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }
#endregion

#region LastModifiedByID
BPXDBLastModifiedByID()]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : PX.Data.BQL.BqlGuid.Field<lastModifiedByID> { }
#endregion

#region LastModifiedByScreenID
ePXDBLastModifiedByScreenID()]
public virtual string LastModifiedByScreenID { get; set; }
public abstract class lastModifiedByScreenID : PX.Data.BQL.BqlString.Field<lastModifiedByScreenID> { }
#endregion

#region Tstamp
tPXDBTimestamp()]
pPXUIField(DisplayName = "Tstamp")]
public virtual bytec] Tstamp { get; set; }
public abstract class tstamp : PX.Data.BQL.BqlByteArray.Field<tstamp> { }
#endregion

#region Noteid
tPXNote()]
public virtual Guid? Noteid { get; set; }
public abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
#endregion
}
}

Graph:

using System;
using PX.Data;

namespace BlyTestObject
{
public class BlyTestObjectMaint : PXGraph<BlyTestObjectMaint>
{

public PXSave<BlyTestObject> Save;
public PXCancel<BlyTestObject> Cancel;

public PXSelect<BlyTestObject> MasterView;

}
}

Referenced Workflow Screen:

 

2 replies

Userlevel 4
Badge +1

Hey All-

Figured it out. I did indeed need a helper class and then I needed to reference it within the field declaration. See below:

Updated DAC Field (Status):

    #region Status
[PXDBString(1, IsFixed = true, InputMask = "")]
[Status.List]
[PXUIField(DisplayName = "Status")]
public virtual string Status { get; set; }
public abstract class status : PX.Data.BQL.BqlString.Field<status> { }
#endregion

Added DAC Helper Class:

using System;
using PX.Data;

namespace BlyTestObject
{
public class Status
{

public const string Hold = "H";

... more values available ...

public const string Hold_LABEL = "On Hold";

... more values available ...

public static readonly string[] Values = new string[] { Hold, ...
public static readonly string[] Labels = new string[] { Hold_LABEL, ...

... more values available ...

public class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(Values, Labels) { }
}
public class hold : PX.Data.BQL.BqlString.Constant<hold>
{
public hold() : base(Hold) { }
}

... more values available ...

}
}

Referenced Workflow Screen:

 

Hope this helps the next person! 

Userlevel 7
Badge

Thank you for sharing your solution with the @rhooper91 !

Reply