Skip to main content
Solved

Employee Time Activity screen - adding custom field to the grid and enabling it


We have a requirement to add a checkbox to the grid in Employee Time Activities. It needs to be enabled and editable and thus, persistable, when the activity is released.

Standard SetEnabled in RowSelected does not work. Enabling the entire column in header also does not work. Overriding the original RowSelected event, where the row is disabled for released activities also does not work for some reason. Any ideas?

Best answer by andriitkachenko

The code provided by @harutyungevorgyan should work. 

What might cause the issue is name of the field (I’ve seen similar issues with fields not adhering to “usr” prefix convention) or different event used to define SetEnabled - in the base graph I see multiple instances of PXUIFieldAttribute.SetEnabled(sender, row, false); for EPActivityApprove, which disables all fields. Generally it is used to disabled all fields except 1-2 specific fields - which are then enabled like this: PXUIFieldAttribute.SetEnabled<EPActivityApprove.hold>(sender, row, true);.

Depending on the event you used, your instructions might become overridden by this disable all command.

Please also check attributes on your field, maybe you set [PXUIField(Enabled = false)] by accident.

I agree with @harutyungevorgyan, it’d be easier for us to help if we can see the code and markup changes.

View original
Did this topic help you find an answer to your question?

5 replies

harutyungevorgyan
Jr Varsity I

Hello @stanaistov , everything is working fine for me. I tried in the last build version of 24R1.

Please let me know which build version you are using.
You can find the working code below:

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class EmployeeActivitiesEntryExt : PXGraphExtension<EmployeeActivitiesEntry>
{
    public virtual void _(Events.RowSelected<EPActivityApprove> e)
    {
        if (e.Row is EPActivityApprove)
            PXUIFieldAttribute.SetEnabled<EPActivityApprove_Ext.usrTestField>(e.Cache, e.Row);
    }
}

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class EPActivityApprove_Ext : PXCacheExtension<EPActivityApprove>
{
    #region UsrTestField
    [PXBool]
    [PXUIField(DisplayName = "Test Field")]
    public bool? UsrTestField { get; set; }
    public abstract class usrTestField : BqlBool.Field<usrTestField> { }
    #endregion
}

And simple ASPX:

<px:PXGridColumn DataField="UsrTestField" Width="60" Type="CheckBox" />


 

 


  • Author
  • Freshman I
  • 5 replies
  • July 22, 2024

I tried that before and it does not work. I am using 23.110.0025.


harutyungevorgyan
Jr Varsity I
stanaistov wrote:

I tried that before and it does not work. I am using 23.110.0025.

Then could you please share your code and aspx here?


andriitkachenko
Jr Varsity I
Forum|alt.badge.img+6

The code provided by @harutyungevorgyan should work. 

What might cause the issue is name of the field (I’ve seen similar issues with fields not adhering to “usr” prefix convention) or different event used to define SetEnabled - in the base graph I see multiple instances of PXUIFieldAttribute.SetEnabled(sender, row, false); for EPActivityApprove, which disables all fields. Generally it is used to disabled all fields except 1-2 specific fields - which are then enabled like this: PXUIFieldAttribute.SetEnabled<EPActivityApprove.hold>(sender, row, true);.

Depending on the event you used, your instructions might become overridden by this disable all command.

Please also check attributes on your field, maybe you set [PXUIField(Enabled = false)] by accident.

I agree with @harutyungevorgyan, it’d be easier for us to help if we can see the code and markup changes.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2749 replies
  • August 20, 2024

Hi @stanaistov were you able to find a solution? Thank you!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings