Reputation: 23
I'm trying to find the best option in Acumatica to import data from another system. The requirments are as follows:
I'm a new Acumatica developer, and my initial instinct was to create a custom data provider like sales force and hubspot providers. I know there are examples of custom data providers to import data from csv and excel files but I couldn't find one where it connects to a third-party API.
If data provider is not the answer, do I have to create a separate RestAPI project to PULL data from the third party. In that case, can someone help me on how to schedule it. I was thinking maybe call the GET method using a timestamp to avoid pulling all payments from the other system.
Any advice is welcome.
Upvotes: 1
Views: 708
Reputation: 8278
You can develop a custom processing screen to import the data:
https://www.acumatica.com/blog/creating-custom-processing-screens-in-acumatica/
Processing screen automatically provide a built-in scheduler that run the process at scheduled interval:
When building a custom processing screen you must follow guidelines of 'Processing Screen' but there are no restriction on how to develop the import logic. You don't need a custom data provider if you built a custom processing screen for import logic.
AUSchedule DAC to determine the date/time of the last scheduled execution:
PXGraph graph = this; // or Base or any graph instance
foreach (PX.SM.AUSchedule schedule in
PXSelect<PX.SM.AUSchedule,
Where<PX.SM.AUSchedule.screenID, Equal<Required<PX.SM.AUSchedule.screenID>>>>
.Select(graph, PXSiteMap.CurrentScreenID))
{
// Check LastRunResult and LastRunStatus fields for last run success/completed
DateTime? lastExecution = schedule.LastRunDate;
}
Instead of looking up last schedule execution you can create a setup DAC in which you have the API configuration URL/credential and put a last run custom field there. When process is run you can update that custom last run field to save the last synchronization time accurately.
You can also build a custom data provider and use it with a custom import scenario. A custom data provider is required only for 'import scenario' which is the built-in method of importing data in Acumatica. Import Scenario are more complex than building a processing screen. In both case you will need to do some programming/configuration to perform REST API call to get data from external service.
You can learn more about building a custom data provider here: https://asiablog.acumatica.com/2016/09/custom-integration-services-data.html
You can get more information about import scenarios in Acumatica training documents: https://openuni.acumatica.com/courses/reporting/i100-integration-scenarios/
Upvotes: 1