Skip to content

Button

Purpose

Button service actions.

Methods

Since 6.9.2

Binding name: p6.button


createDownloadActionFromPipeline

Since 6.9.2

Read the pipeline transaction information to create a download action (formally SURI feature)

Syntax

void p6.button.createDownloadActionFromPipeline(String pathXPath [, String contentTypeXPath])

XPath for contentType can be omitted and application/octet-stream value will be used.

Cases of failure

Exception will be thrown if:

  • if platform6.request.ids.0 is missing in the pipeline
  • if there is no value at the pathXPath in the transaction XML
Example
Transaction XML
<TransactionInfo>
    <SourceDocumentURI>file:///opt/p6core.data/resources/documents/requestForQuotation.xml</SourceDocumentURI>
    <SourceDocumentContentType>text/xml; charset=utf-8</SourceDocumentContentType>
    ...
</TransactionInfo>
Script
p6.button.createDownloadActionFromPipeline('/TransactionInfo/SourceDocumentURI', '/TransactionInfo/SourceDocumentContentType')
Pipeline output
ui.action=DOWNLOAD
download.filename=requestForQuotation.xml
download.contentType=text/xml
download.path=/opt/p6core.data/resources/documents/requestForQuotation.xml

createDisplayActionFromPipeline

Since 6.9.2

Read the pipeline transaction information to create a display action (formally SDOC feature)

Syntax

void p6.button.createDisplayActionFromPipeline(Map<String, String> configuration)
Parameter: configuration
Configuration Name Description
xpath XPath to the file inside the transaction XML
type Optional. the type of document
mode Optional. the display mode

Read more about type and mode in the button service

Tip

type will be automatically extracted based on the file extension on the known types.

Cases of failure

Exception will be thrown if:

  • if platform6.request.ids.0 is missing in the pipeline
  • if there is no value at the xpath in the transaction XML
Example
Transaction XML
<TransactionInfo>
    <SourceDocumentURI>file:///opt/p6core.data/resources/documents/requestForQuotation.xml</SourceDocumentURI>
    <SourceDocumentContentType>text/xml; charset=utf-8</SourceDocumentContentType>
    ...
</TransactionInfo>
Script
p6.button.createDisplayActionFromPipeline([xpath: '/TransactionInfo/SourceDocumentURI'])
Pipeline output
ui.action=DISPLAY
display.path=file:///opt/p6core.data/resources/documents/requestForQuotation.xml