How to access Custom field,which is defined in Construction feature package- Acumatica

妖精的绣舞 提交于 2020-01-16 08:06:10

问题


By reading my question, you might think its very easy, but i request everyone to try to access a custom field defined in the construction feature package.

I want to access "Type" field in Project screen's Task Tab in details

UsrType is a custom field defined in Construction features package. In that package, file has been converted into dll. I tried to access that field like we usually do in customization.

but i got error

Type or Namespace "PMTaskExt" could not be found

I even tried this

I got error

UsrType Doesn't exist in PMTask

There is also same problem with UsrSubcontractNbr field in APTran. Not Only these fields, there are many such field to be accessed. How can we access such fields?


回答1:


From looking at PX.Objects.CN.dll it would be in the PX.Objects.CN.ProjectAccounting.PM.CacheExtensions namespace as PmTaskExt

Used the latest 19R2 Construction project "ConstructionFeatures_19_205_4_1_157"

Decompiled the customization dll (used DotPeek) I searched for PMTask:

Copied text:

using PX.Data;
using PX.Data.BQL;
using PX.Objects.CN.ProjectAccounting.PM.Descriptor;
using PX.Objects.CS;
using PX.Objects.PM;

namespace PX.Objects.CN.ProjectAccounting.PM.CacheExtensions
{
  public sealed class PmTaskExt : PXCacheExtension<PMTask>
  {
    [PXDBString(30)]
    [PXDefault]
    [PXUIField(DisplayName = "Type", Required = true)]
    [ProjectTaskType.List]
    public string UsrType { get; set; }

    public static bool IsActive()
    {
      return PXAccess.FeatureInstalled<FeaturesSet.construction>();
    }

    public abstract class usrType : BqlType<IBqlString, string>.Field<PmTaskExt.usrType>
    {
    }
  }
}

Something like this should work:

var cnExt = PXCache<PX.Objects.PM.PMTask>.GetExtension<PX.Objects.CN.ProjectAccounting.PM.CacheExtensions.PmTaskExt>((PX.Objects.PM.PMTask)e.Row);

Do note the .Net version of PX.Objects.CN.dll is using 4.8 in case that causes any issues with version compatibility in visual studio if your solution is compiled on the same version of Acumatica for 19R2 which is 4.7.1



来源:https://stackoverflow.com/questions/59683661/how-to-access-custom-field-which-is-defined-in-construction-feature-package-acu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!