7 Working with Attachments

This section explains working with attachments using the Oracle Sales Cloud interface.

A variety of methods can be used against business objects to manipulate appointments, interactions and other custom objects. How you can use these methods, along with steps to use the web service payloads and verifying the results in the Oracle Sales Cloud interface, are discussed in this section.

Topics:

Adding an Attachment to an Appointment Using Oracle Sales Cloud Web Services

Topics:

In Oracle Sales Cloud, an attachment can be added to an Appointment, Task, or Interaction. The aim of this section is to provide the steps necessary to create an Attachment object using the Application Composer interface. This section includes the following methods:

  • createAttachment

  • getAttachment

  • deleteAttachment

  • copyAttachment

Creating an Attachment

This section outlines the steps necessary to create an attachment object using the createAttachment method.

Before you get started, you will need to have values for the following fields in hand:

  • EntityName (example: ZMM_ACTIVITIES

  • Pk1Value

  • DatatypeCode (example, FILE)

To get the EntityName object, follow these steps:

  1. Launch Application Composer.

  2. Select Setup and Maintenance from the Application drop-down menu.

  3. In the Overview section, navigate to the All Tasks tab.

  4. Type Attachment in the Name field.

  5. In the Overview section, click the Search button and search using the keyword ZMM in the Entity Name field. Use the EntityName values just like the business object to which we are adding the attachment.

To get the Pk1Value object, you need to determine which business object to which you are adding the attachment.

The following are various sets of Pk1Value objects.

  • Appointment BO > activityId > Pk1Value

  • Task BO > taskId > Pk1Value

  • Interaction > interactionId > Pk1Value

The DataTypeCode object may be a file, a repository file or folder, a URL, or a text.

SOAP Request and Response for Editing an Appointment

The following is the SOAP request for ZMM_ACTIVITIES:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:obj="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:createAttachment>
         <!--Zero or more repetitions:-->
         <typ:attachmentVORows>
                  <obj:DmRepository>FusionAppsContentRepository</obj:DmRepository>
                  <obj:UsageType>S</obj:UsageType>
            <obj:EntityName>ZMM_ACTIVITIES</obj:EntityName>
            <obj:Pk1Value>300000001057211</obj:Pk1Value>
            <obj:DatatypeCode>FILE</obj:DatatypeCode>
            <obj:FileName>sample4.txt</obj:FileName>
            <obj:Title>sample4.txt</obj:Title>
            <obj:DownloadStatus>N</obj:DownloadStatus>
            <obj:CategoryName>MISC</obj:CategoryName>
            <obj:UploadedFileName>sample4.txt</obj:UploadedFileName>
            <obj:UploadedFile>cid:sample4.txt</obj:UploadedFile>
         </typ:attachmentVORows>
         <typ:commitData>Y</typ:commitData>
      </typ:createAttachment>
   </soapenv:Body>
</soapenv:Envelope>

The following is the SOAP response:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/ActivityAppointmentService/createAttachmentResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:1980f58a-a7f9-40b2-bf3f-a50fd4e0deb8</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:createAttachmentResponse xmlns:ns0="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
         <result xmlns="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">SUCCESS</result>
      </ns0:createAttachmentResponse>
   </env:Body>
</env:Envelope>

Make sure to check for the success message in the result window. To verify the message in Oracle Sales Cloud, select the object in the Planned Customer Visits section of the Sales tab. The attachment file will be at the bottom of the appointment object editing window.

SOAP Request and Response for Getting an Attachment for an Existing Business Object (Appointment, Task, or Interaction)

The following is the SOAP request for the getAttachment method:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:obj="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:getAttachment>
         <!--Zero or more repetitions:-->
         <typ:getParameters>
                  <obj:EntityName>ZMM_ACTIVITIES</obj:EntityName>
            <obj:Pk1Value>300000001057211</obj:Pk1Value>            
         </typ:getParameters>
      </typ:getAttachment>
   </soapenv:Body>
</soapenv:Envelope>

The following is the SOAP response for the getAttachment method:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/ActivityAppointmentService/getAttachmentResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:503cd699-1155-45c8-b149-8780f0e593fa</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:getAttachmentResponse xmlns:ns0="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
         <ns1:result xsi:type="ns4:CommonAttachments" xmlns:ns1="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:ns4="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/" xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ns4:AttachedDocumentId>300000001057214</ns4:AttachedDocumentId>
            <ns4:TableName xsi:nil="true"/>
            <ns4:EntityName>ZMM_ACTIVITIES</ns4:EntityName>
            <ns4:Pk1Value>300000001057211</ns4:Pk1Value>
            <ns4:Pk2Value xsi:nil="true"/>
            <ns4:Pk3Value xsi:nil="true"/>
            <ns4:Pk4Value xsi:nil="true"/>
            <ns4:Pk5Value xsi:nil="true"/>
            <ns4:DatatypeCode>FILE</ns4:DatatypeCode>
            <ns4:Description xsi:nil="true"/>
            <ns4:FileName>sample4.txt</ns4:FileName>
            <ns4:UsageType>S</ns4:UsageType>
            <ns4:DmNode xsi:nil="true"/>
            <ns4:DmFolderPath xsi:nil="true"/>
            <ns4:DmType xsi:nil="true"/>
            <ns4:DmVersionNumber xsi:nil="true"/>
            <ns4:URL xsi:nil="true"/>
            <ns4:Title>sample4.txt</ns4:Title>
            <ns4:Attachment xsi:nil="true"/>
            <ns4:EntityAttributes xsi:nil="true"/>
            <ns4:DmRepository>FusionAppsContentRepository</ns4:DmRepository>
            <ns4:DocumentAttributes xsi:nil="true"/>
            <ns4:DownloadStatus xsi:nil="true"/>
            <ns4:DocumentEntityId xsi:nil="true"/>
            <ns4:CategoryName>MISC</ns4:CategoryName>
            <ns4:VersionControlIcon xsi:nil="true"/>
            <ns4:FileURL>/content/conn/FusionAppsContentRepository/uuid/dDocName%3aUCMFA073198?XFND_SCHEME_ID=1&amp;XFND_CERT_FP=89E8C5FE2C629F5BE97C28A484D1A8A644C1D452&amp;XFND_RANDOM=-2315727310942176018&amp;XFND_EXPIRES=1347627918628&amp;XFND_SIGNATURE=MYJcbBvsg95izCh-t6VMcBEyAIn9LC-4aHfZ91UdI-ZOkMEAa7nVSxbJ62jJ~y2h136hObmQfxFBXioEII5VEAHuDUt~KqpbhKM4liLroZpflgVDwJhKsGYe2xotxoRngbSoXfDy4uyUzM1Ql3LATyVmuqO3p4pfBbVLzl5oFvo_&amp;Id=72999</ns4:FileURL>
            <ns4:UploadedText><![CDATA[<?xml version="1.0" encoding="UTF-8" ?><ns1:Order xmlns:ns1="http://xmlns.oracle.com/ns/order" xmlns="http://xmlns.oracle.com/ns/order">
   <ns1:customerId>1111</ns1:customerId>
   <ns1:orderId>2222</ns1:orderId>
   <ns1:prodName>iPod shuffle</ns1:prodName>
   <ns1:itemType>Electronics</ns1:itemType>
   <ns1:price>145</ns1:price>
   <ns1:qty>30</ns1:qty>
   <ns1:status>approved</ns1:status>
   <ns1:creditCardInfo>
      <ns1:cardNumber>1234-1234-1234-1234</ns1:cardNumber>
      <ns1:cardType>Mastercard</ns1:cardType>
   </ns1:creditCardInfo>
</ns1:Order>]]></ns4:UploadedText>
            <ns4:UploadedFileContentType>text/plain</ns4:UploadedFileContentType>
            <ns4:UploadedFileLength>572</ns4:UploadedFileLength>
            <ns4:UploadedFileName xsi:nil="true"/>
         </ns1:result>
      </ns0:getAttachmentResponse>
   </env:Body>
</env:Envelope>

SOAP Request and Response for Deleting an Attachment for an Existing Business Object (Appointment, Task, or Interaction)

Before executing the SOAP request below for deleteAttachment method, you need to get the value for the AttachedDocumentId field from the getAttachment method.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:obj="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:deleteAttachment>
         <typ:deleteParams>
            <obj:AttachedDocumentId>300000001057214</obj:AttachedDocumentId>
         </typ:deleteParams>
         <typ:commitData>Y</typ:commitData>
      </typ:deleteAttachment>
   </soapenv:Body>
</soapenv:Envelope>

The following is the SOAP response for the deleteAttachment method:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/ActivityAppointmentService/deleteAttachmentResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:7b1f0122-18b8-4207-bb08-df32d248d160</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:deleteAttachmentResponse xmlns:ns0="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
         <result xmlns="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">SUCCESS</result>
      </ns0:deleteAttachmentResponse>
   </env:Body>
</env:Envelope>

Check for the success of the message in the result window and verify in the Oracle Sales Cloud interface.

SOAP Request and Response for Copying an Attachment for an Existing Business Object (Appointment, Task, or Interaction)

The following is the SOAP request for the copyAttachment method:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:obj="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:copyAttachment>
         <typ:attachmentVORows>
            <obj:AttachedDocumentId>300000001054856</obj:AttachedDocumentId>
            <obj:Pk1Value>300000001057211</obj:Pk1Value> 
         </typ:attachmentVORows>
         <typ:commitData>Y</typ:commitData>
      </typ:copyAttachment>
   </soapenv:Body>
</soapenv:Envelope>

The following is the SOAP request for the copyAttachment method:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/ActivityAppointmentService/copyAttachmentResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:0dae568b-747e-4777-87ad-231efe000ddd</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:copyAttachmentResponse xmlns:ns0="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
         <result xmlns="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">SUCCESS</result>
      </ns0:copyAttachmentResponse>
   </env:Body>
</env:Envelope>

Adding Attachments to Tasks

Use the createAttachment method to create attachments for an existing business object.

Before you get started, you will need to have values for the following fields in hand:

  • EntityName (example: ZMM_ACTIVITIES

  • Pk1Value (example: TaskId)

  • DatatypeCode (example, FILE)

The following is the SOAP request for the createAttachment method:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/" xmlns:obj="http://xmlns.oracle.com/apps/crmCommon/objects/objectsService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:createAttachment>
         <!--Zero or more repetitions:-->
         <typ:attachmentVORows>
                  <obj:DmRepository>FusionAppsContentRepository</obj:DmRepository>
                  <obj:UsageType>S</obj:UsageType>
            <obj:EntityName>ZMM_TASKS</obj:EntityName>
            <obj:Pk1Value>a41199cf-7586-4957-9bb7-cf11daf92e4e</obj:Pk1Value>
            <obj:DatatypeCode>FILE</obj:DatatypeCode>
            <obj:FileName>sample4.txt</obj:FileName>
            <obj:Title>sample4.txt</obj:Title>
            <obj:DownloadStatus>N</obj:DownloadStatus>
            <obj:CategoryName>MISC</obj:CategoryName>
            <obj:UploadedFileName>sample4.txt</obj:UploadedFileName>
            <obj:UploadedFile>cid:sample4.txt</obj:UploadedFile>
         </typ:attachmentVORows>
         <typ:commitData>Y</typ:commitData>
      </typ:createAttachment>
   </soapenv:Body>
</soapenv:Envelope>

The following is the SOAP response for the createAttachmentweb service:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/ActivityAppointmentService/createAttachmentResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:c8d15311-c86b-456f-8a02-444b18645abe</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:createAttachmentResponse xmlns:ns0="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">
         <result xmlns="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/transient/types/">SUCCESS</result>
      </ns0:createAttachmentResponse>
   </env:Body>
</env:Envelope>

Verify the results in the Oracle Sales Cloud interface.