Solved

Finding the correct item from the report archive

  • 22 January 2024
  • 13 replies
  • 150 views

Userlevel 1
Badge +7

Hi Everyone,

We are interested in surfacing a customer invoice in an external solution similar to this question: 

We want to do something similar to the “Reprint Original From Archive”, but we are not sure how IFS determines which item from the archive to use for this? 

 

Overall, I have a lot of the solution figured out however I’m not sure how we can properly identify the item within the Report Archive? To get to the PDF we need the ResultKey and the Id from within the ArchiveDocumentSet. 

 

I can filter the call to ReportArchive.svc/ArchiveDocumentSet based on what is in the Notes property, But this can result in multiple items if the report has been printed multiple times and feels a little bit like guess work. Is there a better way to determine the correct item within the ArchiveDocumentSet?

 

Any help would be appreciated. 

icon

Best answer by Tomas Ruderfelt 26 January 2024, 07:34

View original

13 replies

Userlevel 7
Badge +31

Hi @MarkMr,

I’m not sure I fully understand your requirement, but if you know the Print Job ID, then there is a function called “GetResultKey” in the “ReportArchive” projection. You can pass the Print Job ID as a parameter to this function and retrieve the Result Key, which you can then use to retrieve the PDF. In the API Documentation, you can find this function under the “Service Operations - Functions” section.

Hope this helps. 

Userlevel 1
Badge +7

Hi Charith,

Sorry if I wasn’t clear, what I am trying to do is find our customer invoices within the ReportArchive via API and perform the same lookup that “Reprint Original From Archive” does. I have the invoice information, but I don’t know how to correlate that with the entries in the ReportArchive  ArchiveDocumentSet. 

I can do it by filtering on the Notes property of the items within the ArchiveDocumentSet:

 

As that seems to contain the Order Number and Invoice Number:

ArchiveDocumentSet

But filtering based on the Notes feels implicit as opposed to explicit. Is there any way to explicitly link an entry in the ReportArchive  ArchiveDocumentSet with the object that created it? In my example the Customer Invoice. I don’t see any other information within the ArchiveDocumentSet that links this with the Customer Invoice.

Userlevel 7
Badge +19

The re-print for customer invoice is using fields on the invoice to find the result key.
You can find two attributes “OriginalResultKey” and “LatestResultKey” in the projection: InvoiceEntity
 

 

That is not a 100% guarantee that the PDF’s exists. They are only saved a certain number of days defined in the default lifetime in “Report Definitions”.

 

Userlevel 1
Badge +7

Hi Thomas,

 

Thanks for the information that is exactly what I’m looking for. However I don't see that projection in our API Explorer. We are using Apps10 not the cloud version. I’m not sure how the API has changed between versions. 

 

When I look at CustomerOrderInvoiceHandling I don’t see any information about the ResultKey. Is the Resultkey available in Apps10 somewhere?

 

Thanks,

 

Mark 

 

 

Userlevel 7
Badge +19

If you are on APP10 I think the best projection is CustomerInvoiceAnalysis and OutgoingInvoiceSet.
In later versions of IFS Cloud most STD entities have own entity projections so there you  have much more flexibility.
 

 

 

Userlevel 1
Badge +7

Ah thanks!  I was only looking in the CustomerOrderInvoiceHandling projection I didn’t even think to look elsewhere. 

 

I think that this will do exactly what we are looking for. 

 

Thanks again!

Userlevel 1
Badge +7

@Tomas Ruderfelt Quick question for you, do you happen to know where I could find the same information for a Bill of Lading? I took a look at the ShipmentSet and OverviewShipmentSet but I couldn’t find a ResultKey.

 

Thanks,

Mark Mruss

Userlevel 7
Badge +19

From my knowledge, the functionality to store the result key only exists on Invoice. Shipment does not have that functionality.

Userlevel 1
Badge +7

Ok Thanks @Tomas Ruderfelt , is there a clean way then to match a shipment that has generated a BOL to the BOL that was generated in the Report Archive?

Is this functionality in Cloud? It seems like something that would be desirable, but maybe I’m not understanding the way IFS is expecting this to work? 

Maybe there is a better way to handle this. If we want to be able to surface documents using external API’s what is the best way to find the documents that have been previously generated? Should we be using something other than the Report Archive?

 

Thanks,

Mark Mruss

Userlevel 7
Badge +19

Unfortunately there is no good connection between generated report in the report archive and the object that created it.

STD functionality works fine without it but of course it would have been nice to have it for your specific scenario.
The only reference you have might be in the notes field, but that I do not advice you to make any searches for in an automatic way since the performance will be poor:

 

A better way to solve this might be to configure a report rule in IFS to take the generated PDF and attach it as a document to the shipment. Then it is connected to the shipment and you can easily find it. It is also never removed from the system.

There are a couple of posts here in the community with details.

 

Userlevel 1
Badge +7

Hi Thomas,

 

Thanks for the replay that makes sense. Do you know if this has been updated in IFS Cloud? It seems like something you would want to have (e.g. a way to link the report to the entity that generated it) but perhaps there are things in the background that I don’t fully understand that make that a difficult proposition.

I will dig into the report actions. It’s actually the solution that we came to on our own, attaching the document to the customer order, so that we are not “guessing” if it’s the correct document.

Userlevel 7
Badge +19

Hi Thomas,

 

Thanks for the replay that makes sense. Do you know if this has been updated in IFS Cloud? It seems like something you would want to have (e.g. a way to link the report to the entity that generated it) but perhaps there are things in the background that I don’t fully understand that make that a difficult proposition.

I will dig into the report actions. It’s actually the solution that we came to on our own, attaching the document to the customer order, so that we are not “guessing” if it’s the correct document.

The functionality is the same in IFS Cloud.

Userlevel 1
Badge +7

Ah too bad, thanks for the the information Tomas. We will look into using the report actions to attach the documents as this seems like the preferred approach regardless of IFS version.

Reply