Oracle by Example brandingCreating the Attachment Steps

section 0Before You Begin

This 30-minute tutorial shows you how to build an orchestration that uses many of the new operations available in the Attachments step in the Orchestrator Studio.

In this tutorial, you will:

  1. Create an orchestration to get, add, and update text attachments.
  2. Create an orchestration that receives file input and uploads the received file input as a file-type attachment.
  3. Create an orchestration that retrieves a file attachment from JD Edwards EnterpriseOne and returns it as file output in the orchestration response.

Background

Starting with Tools Release 9.2.6.0, a new step type called Attachments is available in the Orchestrator Studio. Using this step, you can call the attachment (media object) REST APIs that were previously available as REST calls. These seven actions are available in the Attachments page of the Orchestrator Studio to manage attachments:

  • List: Applies to file, text, and URL attachments types
  • Get Text: Applies to text attachments type
  • Add: Applies to text and URL attachments types
  • Update Text: Applies to text attachments type
  • Upload File: Applies to file attachments type
  • Download File: Applies to file attachments type.
  • Delete: Applies to file, text, and URL attachments types.

section 1Creating an Orchestration to Manage Text Attachments

In this task, you will learn how to use the new Attachment step within an orchestration to manage text type attachments.

Note: This task relies on EnterpriseOne demo data. You can use other data available in your system to enter a sales order to perform this task.

Getting a List of Existing Attachments

  1. Sign in to the EnterpriseOne web client.
  2. Access the Manage Existing Order (P42101) application using the Fast Path or open the application from the Navigator menu.
    1. Click Find and search for the record that has the paper clip icon. For example, search for Order Number 411.
    2. Select the record, click the Row menu, select Order , and then select Header Attachments.
    3. Attachment Manager Window
      Attachment Manager Window
    4. Click the About Attachments icon (i) in the Attachment Manager window and note the structure name. In this example, the structure name is GT4201A.
    5. Attachment Information
      Attachment Information
  3. Sign in to the JD Edwards Orchestrator Studio.
  4. Click Orchestrations and click New.
  5. In the Name field, enter Order Text Attachments.
  6. To add a step, click the Add icon (+) icon and select Attachments.
  7. Click New.
  8. In the Name field, enter ListAllOrderAttachments.
  9. In the Structure Name field, enter GT4201A, and press the Tab key. The values in the Keys table are automatically populated.
  10.  Structure Name Field
    Structure Name Field
  11. In the Action section, select the List option.
  12. Click Save and click the Close icon.
  13. Click Save to save the orchestration.
  14. Click the ListAllOrderAttachments step and select Transformations.
  15. Click the Add Inputs to Orchestration button and then click the Auto Map button.
  16. Click Save.
  17. Click the End icon and click Outputs and Assertions.
  18. Enable the Select All option and click outside the window to close the Outputs and Assertions window.
  19. Click Save to save the orchestration.
  20. Click the Start icon and select Inputs and Values.
  21. Enter these values in the Default Values field for the inputs and save the orchestration:
  22. Input Default Value
    mnDocumentorderinvoicee 411
    szOrdertype
    SO
    szCompanykeyorderno
    00200
  23. Click the Start icon and click Run Orchestration.
  24. Click Run.
  25. Examine the response, notice that all the types of attachments and their individual details are included.
  26. Run Orchestrations Window
    Run Orchestrations Window

Getting a List of Existing Text Attachments

  1. Sign in to the EnterpriseOne web client.
  2. Access the Manage Existing Order (P42101) application using the Fast Path or open the application from the Navigator menu.
  3. Click Find and search for the record that has the paper clip icon. For example, search for Order Number 411.
  4. Select the record, click the Row menu, click Order , and then select Header Attachments.
  5. Ensure that the Attachment Manager window contains at least one text attachment. If a text attachment is not available, click the Add icon (+) and add a text attachment.
  6. Attachment Manager Window
    Attachment Manager Window
  7. Access the JD Edwards Orchestrator Studio.
  8. Click the Orchestrations icon .
  9. Click the Order Text Attachments orchestration created in the “Getting a List of Existing Attachments” section.
  10. Click Design Mode.
  11. Click the Add icon (+)after the ListAllOrderAttachments step.
  12. Select Attachments and click New.
  13. Enter the name as GetTextAttachments.
  14. Enter the structure name as GT4201A, and press the Tab key. The values in the Keys table are automatically populated.
  15. In the Action section, select the Get Text option
  16. In the Input section, enable the Get All option and then click Save to save the attachment step.
  17. Click Close to return to the orchestration.
  18. Click the new GetTextAttachments step and click Transformations.
  19. Click Auto Map and click Save.
  20. Click the End icon and click Outputs and Assertions.
  21. Enable the Select All option and then click Save to save the orchestration .
  22. Click the Start icon and select Inputs and Values.
  23. Enter these values in the Default Value field for the inputs and save the orchestration.
    Input Default Value
    mnDocumentorderinvoicee 411
    szOrdertype
    SO
    szCompanykeyorderno
    00200
  24. Inputs and Values Window
    Inputs and Values Window
  25. Click the Start step and then click Run Orchestration.
  26. Click Run.
  27. Scroll to the end of the output to see the details of the text attachments returned in the response. Make a note of the sequence number returned for the text attachments. In the following example, the sequence number is 16.
  28.  Run Orchestrations Window
    Run Orchestrations Window

Getting a Single Text Attachment

  1. Access the JD Edwards Orchestrator Studio.
  2. Click the Orchestrations icon.
  3. Click the Order Text Attachments orchestration.
  4. Click Design Mode.
  5. Click the Add icon (+) icon after the GetTextAttachments step.
  6. Select Attachments and click New.
  7. Enter the name as GetSingleTextAttachment.
  8. In the Structure Name field, enter GT4201A, and press the Tab key. The values in the Keys table are automatically populated.
  9. In the Action section, click the Get Text option.
  10. Enter the sequence number as a variable: ${sequenceNo}.
  11. Save the attachment step and return to the orchestration.
  12. Click the GetSingleTextAttachment step and click Transformations.
  13. Click Auto Map. The system automatically populates the Keys table.
  14. Enter your sequence number in the Default Value field of the sequenceNo input field. For example, enter 16.
  15. Transformations Window
    Transformations Window
  16. Click Save.
  17. Click the End icon and select Outputs and Assertions.
  18. For the attachment GetSingleTextAttachment, enable the Return All Grids option. In the Output field, replace the default name with this new name : textAttachmentsSingle.
  19. Enable the Select option for the fields sequence, itemName, and text.
  20.  Select Option in Outputs and Assertions Window
    Select Option in Outputs and Assertions Window
  21. Save the orchestration.
  22. Click the Start icon and click Run Orchestration.
  23. Click Run.
  24. Scroll to the end of the output and examine the response. Notice that the details of the text attachments for that key are provided, and the new section contains just the text attachment for the specified sequence number, which is 16.
  25. Run Orchestrations Window
    Run Orchestrations Window

Adding a Text Attachment

  1. Access the JD Edwards Orchestrator Studio.
  2. Click the Orchestrations icon.
  3. Click the Order Text Attachments orchestration.
  4. Click Design Mode.
  5. Click the Add icon (+)after the GetSingleTextAttachment step.
  6. Select Attachments and click New.
  7. Enter the name as AddTextAttachment.
  8. In the Structure Name field, enter GT4201A, and press the Tab key. The values in the Keys table are automatically populated.
  9. In the Action section, click the Add option.
  10. In the Input field, select the Text option for the Attachment Type field.
  11. In the Item Name field, enter OrchestrationAddText.
  12. Enter this variable for the Text field: ${newOrchText}.
  13. In the Output section, in the Sequence Variable field, enter addSeqNo.
  14. Note: Notice the difference between the input variables and the output variables. For the input variables, the variable notation is used (because inputs can be literal values or variables). For the output variables, the variable notation is not used, as each of these variables are just a name given to a known output value.

    Input and Output Sections
    Input and Output Sections
  15. Save the step and return to the orchestration.
  16. Click the AddTextAttachment step and select Transformations.
  17. Click Auto Map to populate the Keys table, and in the Default Value field for the newOrchText input field, enter New Text from Orchestration.
  18. Click Save.
  19. Transformations Window
    Transformations Window
  20. Click the End icon and select Outputs and Assertions.
  21. Scroll to the bottom of the output and find AddTextAttachment. Enable the Select option for the sequence field. Change the value in the Output field to newTextSequence.
  22. Click Save.
  23. Select Option
    Select Option
  24. Click the Start icon and select Run Orchestration.
  25. Click Run.
  26. Scroll to the end of the output and notice that a new sequence number is provided for the added text attachment.
  27. Run Orchestrations Window
    Run Orchestrations Window

Updating a Text Attachment

  1. Access the JD Edwards Orchestrator Studio.
  2. Click the Orchestrations icon.
  3. Click the Order Text Attachments orchestration.
  4. Click Design Mode.
  5. Click the Add icon (+) icon after the AddTextAttachment step.
  6. Select Attachments and click New.
  7. Enter the name as UpdateTextAttachment.
  8. Enter GT4201A in the Structure Name field, and press the Tab key. The values in the Keys table are automatically populated.
  9. In the Action section, select the Update Text option
  10. In the Sequence field, enter ${updateTextSeq}.
  11. Select the Append option.
  12. In the Text field, enter ${appendText}.
  13. Input Section
    Input Section
  14. Save the step and return to the orchestration.
  15. Click the UpdateTextAttachment step and click Transformations.
  16. Click Auto Map to populate the Keys table.
  17. For the UpdateTextSeq input, select addSeqNo from the Available Values drop-down menu.
  18. Transformations Window
    Transformations Window
  19. For the appendText input, in the Default Value field, enter More text from orchestration.
  20. Click Save.
  21. Click the End icon and select Outputs and Assertions.
  22. Scroll to the bottom of the output and for the UpdateTextAttachment attachment, enable the Select option.
  23. Enable Option for UpdateTextAttachment
    Enable Option for UpdateTextAttachment
  24. Save the orchestration.
  25. Click the Start icon and select Run Orchestration.
  26. Click Run.
  27. Scroll to the end of the output and notice the update status.
  28. Run Orchestrations Window
    Run Orchestrations Window
  29. From the Tools menu, click JD Edwards EnterpriseOne, and navigate to P42101. Search for and find your order.
  30. Select the order, from the Row menu, select Order, and then click Header Attachments.
  31. Notice that the new attachment is updated with the name from the add step and it is also updated with the append text from the update step.
  32. Text Attachment
    Text Attachment

section 2Creating an Orchestration that Accepts and Uploads Files as EnterpriseOne Attachments

In this exercise, you will define an orchestration that receives any number of files containing the key information for an order, and upload those files as attachments to that order key.

Creating an Orchestration to Receive Files

  1. From the Orchestrator Studio home page, select Attachments.
  2. Click New.
  3. In the Name field, enter UploadOrderAttachmentFile.
  4. Enter GT4201A as the structure name , and press the Tab key. The values in the Keys table are automatically populated.
  5. In the Action section, select the Upload File option.
  6. Leave the Item Name field blank (it will be populated with the file name by default).
  7. In the File Name field, enter the variable input value as ${fileName}.
    This file is always stored in a temporary directory. First, the system looks for the file in the user session temporary directory, and then in the root temporary directory.
  8. Save the attachment step.
  9. Attachment Step
    Attachment Step
  10. From the Manage menu, click Create Orchestration.
  11. Save the new orchestration (retain the default name).
  12. Click the Start icon and click Inputs and Values.
  13. Click the Delete icon (X) to delete the fileName input. In this tutorial, you will create an array of files to use as input.
  14. Enter these values in the Default Value field for the inputs.
  15. Input Default Value
    mnDocumentorderinvoicee 411
    szOrdertype
    SO
    szCompanykeyorderno
    00200
    Inputs and Values Window
    Inputs and Values Window
  16. Click the File Inputs tab and perform these steps:
    1. Select the Process Files As An Array option.
    2. Enable the Overwrite Existing Files option to keep the original file names.
    3. In the File Array Name field, enter FileArray.
  17.  File Inputs Tab
    File Inputs Tab
  18. Save the orchestration.
  19. Click the UploadOrderAttachmentFile step and click Transformations.
  20. From the Iterate Over drop-down menu, select FileArray.
  21. Disable the Return Raw Output option.
  22. From the Available Values drop-down list in the fileName row, select FileArray.fileName.
  23. Transformations Window
    Transformations Window
  24. Save the orchestration.
  25. Click the Start icon and click Run Orchestration.
  26. Click the Files(0) button and select a few files from your local machine.
    They must be valid files that can be uploaded as attachments in EnterpriseOne. A configuration controls which extensions are allowed. For this example, a .txt file, a .jpg file, and a .pdf file are used.
  27. Files Window
    Files Window
  28. Click Run.
    The response shows that the upload step runs for each file in the request.
  29. Run Orchestrations Window
    Run Orchestrations Window
  30. From the Tools menu, click JD Edwards EnterpriseOne, and navigate to P42101. Search for and find your order.
  31.  Select the order, from the Row menu, select Order and then select Header Attachments.
    You should see the files that were just uploaded through the orchestration.
  32. Attachment Manager Window
    Attachment Manager Window

section 3Creating an Orchestration to Download File Type Attachments

In this task, you will create an orchestration that fetches files from the order attachments and returns those files in the orchestration response.

  1. From the Orchestrator Studio home page, select Attachments.
  2. Click New.
  3. In the Name field, enter DownloadOrderAttachmentFiles.
  4. Enter the structure name as GT4201A, and press the Tab key. The values in the Keys table are automatically populated.
  5. In the Action section, select the Download File option.
  6. Enable the Download All option.
  7. In the Output section, in the Data Set Variable Name field, enter downloadedFiles.
  8. Save the attachment step.
  9. Attachment Step
    Attachment Step
  10. From the Manage menu, select Create Orchestration.
  11. Save the resulting orchestration.
  12. Click the End icon and choose Outputs and Assertions.
  13. Click the Files tab.
  14. Select the Response is a .zip file option.
  15. In the first row, enable the Array option .
  16. From the Array Variable drop-down menu, select the dowloadedFiles option and from the Output File Variable drop-down menu, select fileName.
  17. Outputs and Assertions Window
    Outputs and Assertions Window
  18. Save the orchestration.
  19. Click the Start icon and click Inputs and Values.
  20. Enter these values for in the Default Value field for the inputs and save the orchestration.
  21. Input Default Value
    mnDocumentorderinvoicee 411
    szOrdertype
    SO
    szCompanykeyorderno
    00200
  22. Click the Start icon and click Run Orchestration.
    Note: To download file inputs, change the value selected in the Accept drop-down menu to application/octet-stream.
  23. Run Orchestrations Window 
    Run Orchestrations Window
  24. Click Run.
  25. Verify that the resulting .zip file is downloaded by your browser.
  26. Downloaded ZIP File 
    Downloaded ZIP File
  27. Open the .zip file to view the attached files. The .zip file contains all the file-type attachments for that media object key.
  28. Downloaded Files
    Downloaded Files

more informationWant to Learn More?