Skip to main content
Solved

How to change/save an extern document with UGUI


Forum|alt.badge.img+4

I am using the API of Documizers to generate documents outside our ERP. The formed document can be a .docx or a .pdf. I can retrieve both types and link them to a ERP-record so the user can view them in the application. First challenge is how to make it easy for the user to change and save the .docx without download/upload the document. The second challenge is using a process flow to form an .pdf from the last docx-version to mail it to the customer.
Anyone a bright idea ? πŸ€”

Best answer by Mark Jongeling

Hi Peter, 

I haven't used the API myself so much ether so my reply might contain some little errors:

The File API can be called by using the following URL:

/iam/appl/{table}({key})/appl.preview_{file_column}

In 2024.2, you can use Web connections to make requests to any services. As base url, set the Indicium URL like "https://[server].[com/nl]/[indicium location]/iam/[application alias]” e.g.

https://thinkwise.web/indicium/iam/appl/

Setup the authentication needed to authenticate the request. 

Create an endpoint with either:

  • {table}({key})/appl.preview_{file_column}
    • Every {...} is an input parameter and need to get a value from Process action input parameter
  • table_name({identity_value})/appl.preview_{file_column}   
    • (if you only have an identity as PK)
  • table_name(β€œpk_column_1”: "{value1}”, β€œpk_column_1”: "{value2}”)/appl.preview_{file_column} 
    • (if you have multiple PK columns)

Create input variables where required.

Then Create an output parameter that will hold the binary data of the requested file. Note that this will be returned in the JSON as Base64 encoded binary. Check the Base64 decode option for this parameter and list the following XPath $.{file_column}.file.

That should make the Web connection perfect to be used πŸ˜„ Then the process flow, create a process flow with the Web connection process action. Ensure the input variables are given the correct values and capture the output parameter in a process variable with varbinary(max) datatype. This is holding the .pdf file and can be written to a storage with Write file or send as attachment with the email connector.

It's indeed quite some work but it certainly will resolve the challenge. Feel free to create an idea for a "Create PDF” process action. That would make the entire process a lot more simple.

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi Peter,

For the first part, the document is stored in a location that Indicium can reach but most likely your user cannot reach from their computer. Therefore they would need to download the document, edit it, and then reupload it (as a new version for example).

As a way to make it work, I can imagine a process flow that would can the document to your ERP as file, but also as a Database stored HTML string. That way you could alter it via the HML control; but .docx and .pdf are not easily altered that way I think.

For the second part, you can make clever use of the File API | Thinkwise Documentation (thinkwisesoftware.com). Indicium can access the file and it will be automatically converted to PDF. The response from Indicium contains the file data that you can then send to your customer(s).

Alternatively you can use Reports for this, and export to PDF. However, this will be more easy from 2024.3 in which you will be able to dynamically select a file from a storage location, rather than a file path on disk.

Hope this gives some inspiration!


Forum|alt.badge.img+4
  • Author
  • Sidekick
  • 27 replies
  • August 26, 2024

Goodmorning Mark,

Thanks for your response. I read the description you linked (File API) but i don't have a clue where to start… Do i have to create a procesflow with a HTTP-GET ? What are the parameters, how to send in the filename ? Can you offer me a bit more help please πŸ˜‰ ?


Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • 3940 replies
  • Answer
  • August 26, 2024

Hi Peter, 

I haven't used the API myself so much ether so my reply might contain some little errors:

The File API can be called by using the following URL:

/iam/appl/{table}({key})/appl.preview_{file_column}

In 2024.2, you can use Web connections to make requests to any services. As base url, set the Indicium URL like "https://[server].[com/nl]/[indicium location]/iam/[application alias]” e.g.

https://thinkwise.web/indicium/iam/appl/

Setup the authentication needed to authenticate the request. 

Create an endpoint with either:

  • {table}({key})/appl.preview_{file_column}
    • Every {...} is an input parameter and need to get a value from Process action input parameter
  • table_name({identity_value})/appl.preview_{file_column}   
    • (if you only have an identity as PK)
  • table_name(β€œpk_column_1”: "{value1}”, β€œpk_column_1”: "{value2}”)/appl.preview_{file_column} 
    • (if you have multiple PK columns)

Create input variables where required.

Then Create an output parameter that will hold the binary data of the requested file. Note that this will be returned in the JSON as Base64 encoded binary. Check the Base64 decode option for this parameter and list the following XPath $.{file_column}.file.

That should make the Web connection perfect to be used πŸ˜„ Then the process flow, create a process flow with the Web connection process action. Ensure the input variables are given the correct values and capture the output parameter in a process variable with varbinary(max) datatype. This is holding the .pdf file and can be written to a storage with Write file or send as attachment with the email connector.

It's indeed quite some work but it certainly will resolve the challenge. Feel free to create an idea for a "Create PDF” process action. That would make the entire process a lot more simple.


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9

Hi @Peter de Wit, do you still require assistance on this?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings