Attachment count

Riaz3
Giga Expert

Hi,

Is it possible in any way to report on the number of attachments on a form?

Ideally, in a List view i would like a field to say Attachments, and then have the number of attachments of that record or even a true of false.

Thanks.

1 ACCEPTED SOLUTION

I just spotted one more thing that you'll need to change this to an After, which I found worked better.

I also set the Condition line on the Advanced tab to be (so set this for the correct table on each of your Business Rules): 

current.table_name == "ast_contract"
 
Which will provide the values for the queries. And as I already mentioned, the result was being fed to the "u_attachments" integer field on the Contract record. So you would set the 5th line in the "setAttachmentNum(num)" function to:
task.u_attachment_count = num;
 

View solution in original post

11 REPLIES 11

The field "u_attachments" is an integer field I created on (in this case the Contract table) my target record.

Oh, and my mistake this should be run on Insert and Delete, not Update.

As for the table to run it on, it should be the target table; which for my use was ast_contract. So this should reside on the table that you want the attachment count on.

Thanks Ian, in your script what is the field name? 

I also need this on the contract table, my field is called u_attachment_count

find_real_file.png

I just spotted one more thing that you'll need to change this to an After, which I found worked better.

I also set the Condition line on the Advanced tab to be (so set this for the correct table on each of your Business Rules): 

current.table_name == "ast_contract"
 
Which will provide the values for the queries. And as I already mentioned, the result was being fed to the "u_attachments" integer field on the Contract record. So you would set the 5th line in the "setAttachmentNum(num)" function to:
task.u_attachment_count = num;
 

Thanks Ian, this is great. Very much appreciate 🙂 

Hello Ian,

I have tried this and it only works when there is an existing record. If I try to create a new record and attach a doc it does not show the count (shows blank on field list). I have changed the condition removing it from the when to run tab to the actual script and still does not show the count of attachment when entering a new record. Will appreciate your input on this.