Attachments are not visible on custom widget on catalog item view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2023 03:08 AM
Hello All,
I have made a custom widget for 'Add attachment' on service catalog but there is a issue I am facing that the attached items I am not able to view on catalog item view but can be viewed on RITMs.
I want to view those attached items on cat item view also. Below are the script given.
Please let me know how can I achieve this.
HTML:
<div ng-bind-html="::data.html"></div>
<div>
<span class="file-upload-input">
<input type="file" style="display: none" multiple="true" ng-file-select="parent.attachmentHandler.onFileSelect($files)" class="sp-attachments-input">
<a href="javascript:void(0)" id="attachment_add" ng-click="parent.attachmentHandler.openSelector($event)" class="btn btn-primary sp-attachment-add">
<span class="glyphicon glyphicon-paperclip"></span>
<span ng-bind-html="::data.buttonCaption" style="padding-left: 10px"></span>
</a>
</span>
</div>
server side:
(function() {
data.html = "";
data.buttonCaption = gs.getMessage("Attachment_Button_with_HTML.Caption.AddAttachments");
if(options){
if(options.ui_message_key){
data.html = gs.getMessage(options.ui_message_key);
}
if(options.attachment_button_caption_key){
data.buttonCaption = gs.getMessage(options.attachment_button_caption_key);
}
}
})();
client controller:
api.controller = function($scope, $sce) {
var c = this;
$scope.data.html = $sce.trustAsHtml($scope.data.html);
$scope.parent = getParent($scope);
};
function getParent(parent) {
if (parent.item) {
return parent;
} else {
if (parent.$parent){
return getParent(parent.$parent);
} else {
//console.warn('Was not able to find parent widget');
}
}
}
Thanks
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2023 03:30 AM
Hi @Apps10 ,
This issue can occur if angular provider "spAttachmentManager" is missing on custom form widget.
Resolution
- Navigate to custom Form widget.
- Scroll down to related list.
- Find "Angular Providers"
- Click on Edit
- Add "spAttachmentManager"
- Save and test
OR,
- When you add attachment while submitting the catalog item, an corresponding entry in sys_attachment table is made. This entry suppose to point to the custom requested item table name. But it was pointing to standard requested item table sc_req_item.
- Due to this reason the attachment is not visible.
So,Write a custom logic (before insert/update business rule on the custom requested class table) to update the sys_attachment record's table_name to the corresponding custom requested item table name instead of sc_req_item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2023 03:40 AM
Hello Sandeep,
Thanks for the reply.
spAttachmentManager I have already provided it but still no luck.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2023 04:02 AM
Hello Sandeep,
Could you please help me with the logic(BR).
Thanks