Article

Adding of "Attachment and Notes" tab into custom section

Case description:

We want to add tab with attachments and notes into custom section.

This tab looks like this:

Figure 0. "Attachment and notes" tab on contact page.

Algorithm of realization:

  1. Create object which will represent file object in DataBase (ex. ContactFile object in base packages). This object can be exist.
    • You should create new Object and configure it like at next figure:

      Figure 1. Configuration of custom file object.



      IMPORTANT!!! This object must be inherited from File (Base)

       
  2. Add "Notes" field to your section object. It must be multi-line string and have unlimited length 
  3. Add detail to client schema of your page in details section

    Files: {
        schemaName: "FileDetailV2",
        entitySchemaName: "ContactFile", //Name of your object which represent file which connected with you main object
        filter: {
            masterColumn: "Id",
            detailColumn: "Contact"
        }
    },

     

  4. Add code for "define tab", "attachment detail" and "notes field group" in your page. This code you should insert in diff section of your client schema.

     Collapse source

    {
        "operation": "insert",
        "name": "NotesAndFilesTab",
        "parentName": "Tabs",
        "propertyName": "tabs",
        "index": 3,
        "values": {
            "caption": {"bindTo": "Resources.Strings.NotesAndFilesTabCaption"},
            "items": []
        }
    },
    {
        "operation": "insert",
        "parentName": "NotesAndFilesTab",
        "propertyName": "items",
        "name": "Files",
        "values": {
            "itemType": Terrasoft.ViewItemType.DETAIL
        }
    },
    {
        "operation": "insert",
        "name": "NotesControlGroup",
        "parentName": "NotesAndFilesTab",
        "propertyName": "items",
        "values": {
            "itemType": Terrasoft.ViewItemType.CONTROL_GROUP,
            "items": [],
            "caption": {"bindTo": "Resources.Strings.NotesGroupCaption"}
        }
    },
    {
        "operation": "insert",
        "parentName": "NotesControlGroup",
        "propertyName": "items",
        "name": "Notes", //Name of notes field in your main object
        "values": {
            "contentType": Terrasoft.ContentType.RICH_TEXT,
            "layout": {"column": 0, "row": 0, "colSpan": 24},
            "labelConfig": {
                "visible": false
            },
            "controlConfig": {
                "imageLoaded": {
                    "bindTo": "insertImagesToNotes"
                },
                "images": {
                    "bindTo": "NotesImagesCollection"
                }
            }
        }
    }

     

  5. Add localizable strings to resources of your client schema:

    1. NotesAndFilesTabCaption - tab caption 

    2. NotesGroupCaption - notes group caption

  6. IMPORTANT!!! If you have some troubles try to clear browser cache, redis, recompile schemas in bpm'online or restart web-site.  
Like 1

Like

Share

0 comments
Show all comments