Solved

Customization Default library

  • 19 March 2021
  • 1 reply
  • 124 views

Userlevel 2
Badge

Could anybody help me with customization. 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; }
}
icon

Best answer by Hughes Beausejour 19 March 2021, 16:51

View original

1 reply

Userlevel 5
Badge +2

Acumatica REST API returns the Project entity as JSON text data:

[

    {

        "id": "adbe2391-dd91-e711-944a-12d4d93f21e4",

        "rowNumber": 1,

        "note": {

            "value": ""

        },

        "Assets": {

            "value": 0.000000

        },

        "Customer": {

            "value": "WIDGETBUY"

        },

        "Description": {

            "value": "Prof Services, Progress Billing for Widget Connection"

        },

        "Expenses": {

            "value": 4005.000000

        },

        "ExternalRefNbr": {},

        "Hold": {

            "value": false

        },

        "Income": {

            "value": 10000.000000

        },

        "LastModifiedDateTime": {

            "value": "2017-09-04T19:49:52.05-04:00"

        },

        "Liabilities": {

            "value": 0.000000

        },

        "ProjectID": {

            "value": "2017PROG01"

        },

        "ProjectTemplateID": {

            "value": "PROGRESS01"

        },

        "Status": {

            "value": "Completed"

        },

        "custom": {}

    }
]

The Git Hub REST Client project is not part of Acumatica core product. What it does is provide an object model that is used to convert (serialize) the JSON text to C# objects. This occurs in the REST client outside Acumatica. Therefore it doesn’t fall within Acumatica standards. You can modify the models however you like it won’t affect Acumatica, it only impacts the external REST client.

The Git Hub project is optional. It is not required to access the REST API. Our documentation does provide examples where the object model is not used (only JSON data):
https://help-2021r1.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=1c767ad9-da6d-4047-bc93-6970ad469504

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