Displaying a pdf file from Base64

I used external service to download a file content in Base64 and forwarded it to DocumentList.

How I can do it in ScriptCode?
There are special parameterization for it?

You need to prepare two ScriptServices:

  1. First service:
    a. The first service is connected as an external data source of the DocumentList.

    b. It takes input parameters from Form and prepare output for Document List:
    Zrzut ekranu z 2023-08-28 11-59-47

    fileName - the name of file displayed on Form
    fileMimeType - file types for pdf is application/pdf
    source - type of document source for our purpuse it need to be externalDocument
    documentServiceName - name of the service that returns the contents of the file ( If the
    second service is also ScriptService we need to add ‘script:’ prefix before the service name
    documentServiceParams (optional) - list of parameters that we want to pass beetween first
    and second service it looks like: parameter1=value1&parameter2=value2…

  2. Second service:

    a. Can gets the parameters that we pass from first service
    b. The return file need to be base64 encoded and the return variable name need to be ‘output’