Question

Can I get a Document Type of using that document NoteID programatically?

  • 21 February 2024
  • 6 replies
  • 48 views

Userlevel 7
Badge +8

I am wondering is there a built-in function/method in Acumatica that we can pass a document NoteID and that method returns the Document Type. For example can I pass the NoteID of an AP Bills and Adjustments document NoteID and it return “Bill”, “Credit Adj.”, “Debit Adj.” … or for AR Invoice it rturns “Invoice”, “Debit Memo”, “Credit Memo” … and so on?


6 replies

Userlevel 7
Badge +5

Someone with deeper knowledge might be able to directly answer your question. One potential way would be to use the SearchIndex table. But it does require that the documents be included in the global search so it’s possible your lookup might not return a result even though it is a valid document. But it does have a text column with the EntityType.

Userlevel 7
Badge +8

@Django thank you for your reply. Not sure how practical it’s going to be what you are suggesting considering I need this for quite a few tables with historical data and will need to be foolproof not wishy-washy. 

Userlevel 7
Badge +5

@aaghaei  there is PX.Data.EntityHelper that has several useful methods, e.g.

  • public object GetEntityRow(Guid? noteID)
  • public Type GetEntityRowType(Guid? noteID)
  • public string GetFriendlyEntityName(Guid? noteID)

That’s not exactly what you are looking for, but I think you can use those to implement what you need.

Userlevel 7
Badge +8

@Dmitrii Naumov Thanks for the direction. I have tried GetFriendlyEntityName(Guid? noteID) but it was returning “Document” in AP Bills and Adjustments that I am not sure where its coming from. I will give the two other a shot to see how they will work out.

Userlevel 7
Badge +8

@Django I offer my sincere apology here regarding my comment if it was annoying or offensive. What I meant by “wishy-washy” is the Search Index occasionally gets corrupted and when we perform Search in Acumatica it doesn’t return the correct results requiring to rebuild the Search Indexes. Because of this if we rely on Search Index it can not be really a solid base for coding. Its “OK” for its designated purpose but not really using in code as the code can perform the logic on an absolutely different object/data that we don’t want and fixing it also will be impossible as we don’t know what record is referenced erroneously instead of the intended record. 

Userlevel 7
Badge +5

Cheers!

And that’s good to know about the Search Index not always being in top form.

I’m intrigued by your question and I hope you find an answer because I can see the value in having that functionality.

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