Custom Entity (Attachment Multiple)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tobyd
    Junior Member
    • Jun 2016
    • 4

    Custom Entity (Attachment Multiple)

    My client wants to be able to have a PDF preview when looking at documents associated with entities. Images currently do this, and he wanted PDFs to also have a preview on the page.

    I've already written a custom view, but it only works on the Opportunities entity.
    Click image for larger version

Name:	temp.png
Views:	229
Size:	2.0 KB
ID:	22963


    You can click on the name to launch a preview window, and [Link] is the link you'd normally have. This part works completely fine!

    However... the client would like this new document view to work EVERYWHERE there is an attachmentMultiple field. (We are looking to avoid modifying the core source code, and work just with extensions, otherwise I'd just modify the attachmentMultiple code directly and be done with it.)

    Previously, I was told I had to specify this new view manually for each entity that wants to use it.

    The client is not keen to go that route, unfortunately.

    So, this afternoon, I suggested the possibility of a custom field type. I could just clone the code for attachmentMultiple, and create my own "attachmentMultipleEx" type that would specify the custom view I've written.

    Is this the right path to take? (If not, any suggestions?)

    I've gotten only part way with creating a custom field type. I can add my new attachmentMultipleEx type to Opportunity, and assign it in the Layout Manager, but once I try to list the entries... I'm running into an "Column not found: 1054 Unknown column 'opportunity.test34' in 'field list'" error when I try to view the Opportunity list. (With 'test34' just being the random name I gave it.)

    I'm sure I'm overlooking something basic; I'm not 100% familiar with how all the pieces of the system work, so whatever help I can get I'd appreciate.

    Thanks!
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Hi,

    You can specify custom view class for "attachmentMultiple" type

    Metadata > fields > attachmentMultiple

    "view": "custom:views/fields/attachment-multiple"

    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • alasdaircr
      Active Community Member
      • Aug 2014
      • 525

      #3
      Hello Toby did you get further with this?

      Care to share your code? We're looking to handle previewing Office files via something like Google Apps document preview or OfficeApps.

      Comment

      Working...