I recently had a request for How to Add an Attachment to an Asset. In this instance the idea was to add a picture of the asset to the asset itself. If the Asset database table had an attachment field, that would be easy  however, this needs to be done via custom objects.

I looked around for information but didn't see a step by step guide, so I thought I would add this information...

In order to do this, you would need to create a custom object with an attachment field, then create a workspace for that object, and include that object workspace view in the asset workspace.... Here are the steps:

Create a custom object... so to do this under Configuration->Database->Object Designer click on New->Package and give it a name (i.e. fattach)

Then click New->Object and you will see the screen below, give the object a name (as in this example fatobj)

Then click on Fields at the top and In the custom object, first create a integer field called “AssetID”.
This is a unique field within the Asset ID Table that links the custom object to the existing standard object.

Then click on the checkbox for File Attachment to create the FileAttachments field. You should now see something similar to the screen such as:

Then, click on Relationships and under Relationships, set the following:

1.Type = Aggregation

2.Parent Object = OracleServiceCloud.Asset

3.Child Field = AssetID (the integer you just created on the object)

You should now see the following:

OracleServiceCloud.Asset and AssetID are what links the custom object TO the standard Asset object.

Aggregation means “delete rows of this object when the parent record is deleted” (in other words, when the parent asset is removed, the custom object’s data, for that asset, will be removed as well – i.e. a cascading delete). This is optional, but makes sense logically speaking. Otherwise, if the customer wants to keep attachments even for deleted assets, the Type should be set to Association.

Now click on Extra Options and set CRUD (Create, Read, Update, Delete) permissions for the profile you are setting this up for. You can also do this later in the Profile Permissions after the deployment. You will see the following:

Now save this object by clicking Save at the top. Once saved, now you need to deploy the object, so click Deploy at the top to get the following screen:

Enter your email, and check Deploy Immediately, then click Deploy on the bottom. You will get a notice that the object is deploying… this can take a few minutes so be patient 

Now you have created the fatobj object. So now you need to build a Workspace for that object which includes the file attachment field.

Click on Configuration->Application Appearance->Workspace / Workflows

Now click New Workspace at the top and notice that you have Standard Types and Custom Types. Under Custom Types You should see fatobj as shown here:

.
.
.

On the fatobj Workspace, click Insert Field and add the AssetID and ID fields, and on the tab area, click Insert Control add the control file attachements… your workspace should look like the following:

Save this workspace. This example will use the name fatobjws.

Now if you have an Asset workspace you are using, bring that up. If you don’t go back to the Workspaces/Workflows Explorer tab and look under the Standard folder, right click on Asset and click Copy.

And name it under the Workspaces and Workflows main area.

This example shows using the name myassws.

Now open the myassws workspace. Create a new tab. Click on Insert Control and you will see fatobj view.

Drag that into the tab you created. And you should see:

If you get an error, you may need to double-click in the new tab area to insert the report. If you double-click the tab area, you can then click Report at the top of the screen. This will bring up the select report dialogue. From here choose the following (fatobj by AssetID):

Now, open an existing asset and you can click Add New, then Add Files to attach a file to the asset. Then Save and Click OK.

Hope this helps.