Solved

Renaming a field

  • 28 April 2022
  • 4 replies
  • 147 views

Userlevel 6
Badge +3

In 2021R1, I am trying to change “Start Date” to “Creation Date” on the Tasks Screen CR306020

I’ve gone through the answers on this topic: 

None of them are working.

If you inspect that field it shows this:

I’ve tried doing it in VS for both StartDate and StartDate_Date.  In debug, the StartDate fires so I know I am hitting this code.  I tried StartDate_Date, but that does not fire.

The actual code for the one that fires is:

[PXMergeAttributes(Method = MergeMethod.Append)]
[PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), nameof(PXUIFieldAttribute.DisplayName), "Creation Date")]
protected virtual void CRActivity_StartDate_CacheAttached(PXCache cache)
{
string joe = "joe";
}

I also tried editing the field in the Project Editor:

Neither of these change the Display Name.

I suspect it may have something to do with the fact that the field name shows as StartDate_Date?

StartDate_Date is not a field you can select in the editor.

I am able to make the other three fields required both in the Project Editor AND in VS code.  But this StartDate field does not seem to be able to be modified.

 

 

icon

Best answer by Fernando Amadoz 29 April 2022, 16:29

View original

4 replies

Userlevel 5
Badge +2

Hi @joe21 

You were in the right path. That would be the approach to take for most pages.

However, I was reviewing this page’s graph and noticed that in the constructor, they are assigning the Display Name for that field:

		public CRTaskMaint()
: base()
{
...
PXDBDateAndTimeAttribute.SetDateDisplayName<CRActivity.startDate>(Tasks.Cache, null, Messages.StartDate);
...
}

So, this seems to be prevailing over the CacheAttached approach.

I extended the constructor and was able to change the field name with this reference:

using System;
using System.Collections;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Data.EP;
using PX.Objects.Common.GraphExtensions.Abstract;
using PX.Objects.EP;
using PX.SM;
using System.Collections.Generic;
using PX.Objects;
using PX.Objects.CR;

namespace PX.Objects.CR
{
public class CRTaskMaint_Extension : PXGraphExtension<CRTaskMaint>
{
public override void Initialize()
{
base.Initialize();
PXDBDateAndTimeAttribute.SetDateDisplayName<CRActivity.startDate>(Base.Tasks.Cache, null, "Creation DATE");
}
}
}

 

Userlevel 6
Badge +3

@Fernando Amadoz 

I’m trying to do something similar in another form.  I want to ENABLE a user defined field at all times on the Bills and Adjustments screen.  I’ve been trying to do this for a long time.  Your solution above may work the same way for this field.

In the constructor of the APInvoiceEntry graph extension, I am trying this:

    public class APInvoiceEntry_Extension : PXGraphExtension<APInvoiceEntry>
    {
        public override void Initialize()
        {
            base.Initialize();
            PXUIFieldAttribute.SetEnabled<APRegisterExt.usrProjectID>(Base.Transactions.Cache, null, true);
        }
It is not working.  Is my syntax correct?  It compiles and the screen works with no errors, but the field is still not enabled for posted documents.  

I’ve tried using Base.AllTransactions.Cache, Base.Transactions.Cache, Base.CurrentDocument.Cache.  I don’t know if I am not picking the correct cache.  I’ve tried all the ones that popup with intellisense that look like they might be appropriate.

Any idea on this one? 

 

Userlevel 5
Badge +2

@joe21 I’d suggest creating the second question in a separate post in order to keep the thread related to the same topic and facilitate visibility/legibility for other users of the community.

Please ping me after it’s been created in order to see if I can provide additional input.

Userlevel 6
Badge +3

@Fernando Amadoz I have another post in process re: enabling a UDF on the Journal Transactions screen.  Naveen provided an answer, but it only worked for the Bills and Adjustment screen, but that same process did not work on the Journal Transactions screen.  On that post, he said he is going to see if he can get it to work.  

Your solution to changing the field description above worked great by overriding the constructor so I thought I’d just ask here in case this solution would be appropriate for enabling fields using the constructor.

The other post is here if you want to take a look at it:

Thanks again for solving the problem in this post.  I am so grateful for your help.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved