Skip to main content
Question

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

  • February 21, 2024
  • 6 replies
  • 105 views

aaghaei
Captain II
Forum|alt.badge.img+10

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

Forum|alt.badge.img+7
  • Captain II
  • February 21, 2024

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.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • February 21, 2024

@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. 


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • February 21, 2024

@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.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • February 21, 2024

@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.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • February 21, 2024

@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. 


Forum|alt.badge.img+7
  • Captain II
  • February 21, 2024

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.