Unable to create a functioning detail from a Database View for all email attachments associated with a case

Hi,

I have followed along with the steps detailed on the various academy pages and within this post (https://community.creatio.com/questions/detail-all-email-attachments-ar…), as I too also need to provide a FileDetailV2 based detail section within the Attachment tab of the standard CasePage, detailing all attachments found within Email Activity records associated with the Case.

I have created a database view:

CREATE VIEW dbo.EeviVwCaseEmailAttachments
AS
SELECT
ActivityFile.Id AS "Id", ActivityFile.CreatedOn, ActivityFile.CreatedById, ActivityFile.ModifiedOn, ActivityFile.ModifiedById, ActivityFile.Name, ActivityFile.Notes,
ActivityFile.LockedById, ActivityFile.LockedOn,
ActivityFile.Data, ActivityFile.TypeId, ActivityFile.Version, ActivityFile.Size,
ActivityFile.ActivityId, ActivityFile.CreatedByInvCRM, ActivityFile.Uploaded, ActivityFile.ErrorOnUpload, ActivityFile.Inline,
Activity.Title AS "EeviTitle", Activity.Sender AS "EeviSender",
[Case].Id AS "EeviCaseId"
FROM [Case] INNER JOIN Activity ON ([Case].Id = Activity.CaseId) INNER JOIN ActivityFile ON (Activity.Id = ActivityFile.ActivityId);

And made sure there was a corresponding Schema object 'EeviVwCaseEmailAttachments' with the behaviour flag 'Represents Structure of Database View' ticked:

I've built the appropriate detail schema using the Detail Wizard, added the detail to the CasePage using the Page Designer from the Section Wizard, and that seems to render normally:

But much like Javier Collazo's post, I too see this error in the browser console:

I have published the view schema object, re-compiled all items in the workspace and updated the DB structure in the configuration section, several times, but it doesn't seem to make a difference.

I can certainly access the view using the SQL Query Console, and it returns expected data. 

What's also perplexing is that the Summary sections on the detail are clearly getting data values from somewhere, despite not returning rows to display in the detail list:

What do I need to do to make this work?  And in general to correctly map other database views into schema objects and in turn into section details?

What would also need to be done on the Schema detail page to hide/omit the Drag file here area?

 

Thanks,

 

Lachlan Devantier

 

Like 0

Like

1 comments

So, for any wayward souls looking for answers, the solution here was to override the FileDetailV2 initParentEntity function to provide the correct parentSchemaName value, as opposed to what FileDetailV2 will try to use.

    initParentEntity: function() {
        this.parentEntity = {};
        // set entitySchemaName as the name of your DB view in your SchemaDetail definition
        const parentSchemaName = "<This is the name of the section/card your detail is used on>" ;
        const masterRecordId = this.get("MasterRecordId");
        this.parentEntity.EntityName = parentSchemaName;
        this.parentEntity.RecordId = masterRecordId;
    }

After that, records from the view render in like any other FileDetailV2 based grid list.   Now to work out how to format the list fields into something more human friendly, like File sizes in MB/KB rather than bytes.

 

Show all comments