Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Ross Crockett
    Add FileAttachment to Custom Object via RN Connect Web...Answered
    Topic posted July 8, 2013 by Ross CrockettRed Ribbon: 250+ Points 
    376 Views, 2 Comments
    Title:
    Add FileAttachment to Custom Object via RN Connect Web Service
    Content:

    Hey,

    Has anyone had success in adding a file attachment to a Custom Object using the Connect Web Service API? I can get FileAttachments and do upload via the PHP API but can't figure out how to set the FileAttachmentCommon object in the GenericObject. I've seen exmaples on how to do this with primary objects that offer a setFileAttachments() method, but this isn't an option for Custom Objects (GenericObject).

    I require a simple update of a Custom Object that adds a new attachment to the list of FileAttachments. I have attached a code snippet of where I am at, but basically I need help with the section with the comment.

    Not sure how to get the FileAttachmentCommon object added as an Object Type DataValue and generic field in the Generic Object. Any help would be great!

          

    Code Snippet:

    Best Comment

    Ross Crockett

    Thanks Allan,

    That helped heaps. Once I could see the structure I could build out the fields and objects in Java. For future reference, I am attaching the Java class which adds an attachment. Note it only adds one file attachment but anyone can modify it to use a loop and add multiple. This also does an update of an existing object, but  there's no reason why you couldnt modify it to use Create.

    Cheers,

    Ross

    Comment

     

    • Allan Schrum

      The FileAttachmentCommon object is not used in the generic interface. The FileAttachmentCommon object is constructed using generic objects and generic fields. I have attached the XML I use to attach file attachments - I'll let you decode it for your programming language unless someone else has some sample code.

      I've also attached a way to get file attachment meta data for a custom object.

      Regards,

      -Allan

       

    • Ross Crockett

      Thanks Allan,

      That helped heaps. Once I could see the structure I could build out the fields and objects in Java. For future reference, I am attaching the Java class which adds an attachment. Note it only adds one file attachment but anyone can modify it to use a loop and add multiple. This also does an update of an existing object, but  there's no reason why you couldnt modify it to use Create.

      Cheers,

      Ross