Skip to main content
Answer

How to insert/map a file under Files for a Sales Order record through code

  • March 12, 2024
  • 2 replies
  • 187 views

Hi Team,

We are working with Build 23.112.0032 and working on a customization where we have to add an image url ( https://xyz.s3.amazonaws.com/kkltQWuXULPcHQ6TmoMsZkiJOK93x8.png) as File attachment to a Sales Order record through code. We tried to insert this image url under Name field in UploadFile table and later to map this record along with Sales Order NoteID under NoteDoc table but we are facing issue with approach. Can you please suggest the best possible way to achieve this.

 

Thank you in advance!

 

Best answer by DavidEichner

Hi @maneeshau91 

The best way we have found to attach files to records in Acumatica is to make API calls.  As an example, for a client needing service call history records to have multiple file attachments (images, PDF, excel, word, etc.) from a legacy system, we extracted those files from the legacy system into a folder with filename starting with the service order number and service order type.  We then wrote a simple console app in C# that looped through the folder reading the files, logging into the API and uploading the files to attach them to the service orders.  It would be slightly different code to attach to a sales order with the order number and the order type.

Best,

David

2 replies

DavidEichner
Captain II
Forum|alt.badge.img+13
  • Captain II
  • Answer
  • April 1, 2024

Hi @maneeshau91 

The best way we have found to attach files to records in Acumatica is to make API calls.  As an example, for a client needing service call history records to have multiple file attachments (images, PDF, excel, word, etc.) from a legacy system, we extracted those files from the legacy system into a folder with filename starting with the service order number and service order type.  We then wrote a simple console app in C# that looped through the folder reading the files, logging into the API and uploading the files to attach them to the service orders.  It would be slightly different code to attach to a sales order with the order number and the order type.

Best,

David


charliefitzgerald13
Freshman I

Hi @maneeshau91 

The best way we have found to attach files to records in Acumatica is to make API calls.  As an example, for a client needing service call history records to have multiple file attachments (images, PDF, excel, word, etc.) from a legacy system, we extracted those files from the legacy system into a folder with filename starting with the service order number and service order type.  We then wrote a simple console app in C# that looped through the folder reading the files, logging into the API and uploading the files to attach them to the service orders.  It would be slightly different code to attach to a sales order with the order number and the order type.

Best,

David


Hi ​@DavidEichner , this is a great solution. We may need to do something similar for a client soon. Do you have any advice on where I can learn more about leveraging API calls like this?

 

Thanks,

Charlie