Question

How can I add two Attachment Details for a single Section

Hi All,

 

I have a requirement where I need to have two Attachments Details in a single section. Where I can store different documents without all mixing up in a single detail.

 

eg: I have to have "Attachment detail - A" with "Document A" and "Document B"

and I have to have another attachment detail "Attachment detail - B" with "Document C" and "Document D"

 

is it possible to have a functionality like that.

Any suggestions appreciated,

 

Thanks

Deshan

Like 0

Like

1 comments

Hello,



In order to do it, it's necessary to add those two details on the Section through the Section wizard (in my case they were added to Account section). Once you save the changes, you will find the replacement of edit page schema in Configuration. Then it's necessary to add detail's schemas and filter methods to that schema. After saving the changes in the code, one of the detail would store all files and another one would store all the links.  In addition, it's important to add getDetailInfo method, which helps to prevent any issues that might take place when two details refer the same object. Here is the code for your reference:

 

details: /**SCHEMA_DETAILS*/{

            Files: {

                        schemaName: "FileDetailV2",

                        entitySchemaName: "AccountFile",

                        filter: {

                            masterColumn: "Id",

                            detailColumn: "Account"

                        },

                        filterMethod: "fileDetailFilter"

            },

            SchemaLink: {

                        schemaName: "FileDetailV2",

                        entitySchemaName: "AccountFile",

                        filter: {

                            masterColumn: "Id",

                            detailColumn: "Account"

                        },

                        filterMethod: "linkDetailFilter"

            }

        }/**SCHEMA_DETAILS*/

        methods: {

            init: function() {

                        this.callParent(arguments);

                        this.getDetailInfo();

            },

            

            getDetailInfo: function() {

                

                      var detailInfo = this.callParent(arguments);

                      detailInfo.detailElementsPrefix = Terrasoft.generateGUID();

                      return detailInfo;

            },

            

            fileDetailFilter: function() {

                

                        var filterGroup = new this.Terrasoft.createFilterGroup();

                        filterGroup.add("AccountFile", this.Terrasoft.createColumnFilterWithParameter(

                                this.Terrasoft.ComparisonType.EQUAL, "Type", "529BC2F8-0EE0-DF11-971B-001D60E938C6"));

                        return filterGroup;

            },

            

            linkDetailFilter: function() {

                

                        var filterGroup = new this.Terrasoft.createFilterGroup();

                        filterGroup.add("AccountFile", this.Terrasoft.createColumnFilterWithParameter(

                                this.Terrasoft.ComparisonType.EQUAL, "Type", "539BC2F8-0EE0-DF11-971B-001D60E938C6"));

                        return filterGroup;

            }

            

            

        },

 





Best Regards,

Tetiana Bakai

Show all comments