0
votes

Could anybody help me with acumatica? I have an application, witch connect to acumatica with acumatica libraries: Auth, Default_18.200.001, RESTClient from here: https://github.com/Acumatica/AcumaticaRESTAPIClientForCSharp I am using it like submodules - if somesings will change on git - I always can update it

I needed to add custom fields to the Project form. I did it - added fields, posted changes. After that, I created a new endpoint inheriting it from default endpoint - and the new fields became available to me when working with the Project entity. I achieved this by creating classes that inherit from api and the base model with overriding the GetEntityName() method.

If I need to change the fields, I will have to create new inheritance classes.

Perhaps there is some standard way to support customization fields? And I just didn't find it.

My Api extension:

public class ProjectExtApi : EntityAPI<ProjectExt>
    {
        public ProjectExtApi(Configuration configuration) : base(configuration)
        { }

        protected override string GetEntityName()
        {
            return "Project";    //base code: return typeof(EntityType).Name;
        }
    }

and model:

[DataContract]
public class ProjectExt : Project
{
    [DataMember(Name = "TestDate", EmitDefaultValue = false)]
    public DateTimeValue TestDate { get; set; }
}
1

1 Answers

0
votes

My answer is related to custom fields inside Acumatica product. Custom fields should be added with DAC extensions (PXCacheExtension class), example:

public class MyContractExt : PXCacheExtension<Contract>
{
   #region UsrDateTime
   [PXDBDateAndTime]
   public virtual DateTime? UsrDateTime { get; set; }
   public abstract class usrDateTime : BqlDateTime.Field<usrDateTime> { }
   #endregion
}

Note that PMProject DAC in Acumatica is inheriting from Contract DAC and the field will be persisted in the Contract table. If the field requires to be persisted in database (with PXDBxyz.. attribute instead of PXxyz..) it requires a database script.

It is recommended to add custom field with a customization. When creating a custom field in the Data Access section of a customization the wizard will automatically create the database script to add the column to the table.

External link, tutorial: https://www.acu-connect.com/2019/02/27/customizing-acumatica-erp-adding-a-new-field-to-an-existing-screen/