Adding support for attachments to a custom entity in Infor CRM Web is a pretty simple task as long as you know what the steps are. Luckily, the out of the box attachments SmartParts is built in a way to make it work with new custom entities without customization. It takes only 2 easy steps. Let’s take a look at the steps.
Steps to Add Attachments to a Custom Entity
STEP 1: Adding an ID property for your entity to Attachment
First, you need to add a new ID field for your custom entity to the Attachment entity. Right-click the Attachment entity and select “Modify Entity”. Then add an ID field for your entity. The name of the ID field needs to match the name of the table, not entity. If your custom entity is named “Widget”, and it’s underlying table is “WIDGET”, then add a new property to Attachment named “WidgetID”. If your custom entity is named “CMyEntity” and it’s underlying table is named “C_MYENTITY” then add a property to Attachment named “C_MyEntityID” so it matches the table name. Basically, the property name needs to be “Physical Table Name” + “ID” (the case doesn’t matter as long as the table name matches and technically it will work if you add the ID property to match the entity name instead of the table name and either will work).
STEP 2: Adding the Attachments SmartPart
Add the AttachmentsList.ascx custom SmartPart to your custom entity’s page. Go to the SmartParts list for the page for your custom entity, click the “+” button, select the Custom tab and add SmartParts\Attachment\AttachmentList.ascx.
That is it. The AttachmentList SmartPart handles all the work. Your attachment’s tab will work just like it does on any entity.