Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Create list of documents with link to downloadable file

Is it possible using CRMScript to create a screen with a list of documents and having a link to the actual document so it can be downloaded?

Hi Patrik,

depends how you want to do it - but I would say yes, it is quite possible.

I have created several similar solutions like you describe where I am using External Documents to store the documents and CRMScript to show them.

In some other cases I've built extra tables / fields to store additional attributes so that I could increase the functionality.

A typical SearchEngine could look something like this:

String folderId; // The Id of the folder you want to list documents from

SearchEngine se;
se.bypassNetServer(true);
se.addField("external_document.attachment_id");
se.addCriteria("external_document.deleted", "Equals", "0", "And", 0);
se.addCriteria("external_document.hierarchy_id", "Equals", folderId, "And", 0);

/* Additional Fields and Criterias */

for(se.select(); !se.eof(); se.next())
{
  String attachmentId = se.getField(0);

  Attachment att;
  att.load(attachmentId.toInteger());

  // This generates a link to the file
  String downloadUrl = att.getDownloadUrl(true,true);

  /* ... */
}

Hope this was clarifying

Von: Simen Mostuen Iversen 3. Dez 2020

Would it be doable to do a similar script for documents located under the company card in Sales?

Von: Patrik Larsson 3. Dez 2020

Well - it would be doable, but not as easy as if they existed in Service.

Documents in CRM does not have a download URL as far as I know, but there are ways of manipulating this with CRMScript.

Von: Simen Mostuen Iversen 3. Dez 2020

I see. Thanks for the help!

Von: Patrik Larsson 3. Dez 2020

Hi,

You might find some useful tips in our documentation related to this.

Von: Michel Krohn-Dale 3. Dez 2020

Hi Patrik,

do you really need a download or do you want to open the listed documents in the screen via webtools?

 

Best,

Dennis

Von: Dennis Pabst 7. Dez 2020

Via webtools would be great! But at least show related documents stored in S&M, that is the minimum.

Von: Patrik Larsson 7. Dez 2020