Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Portal Add Attachment Customization

AlwinJebakY
Tera Expert

In ServiceNow Portal, I try to add all supported files list under the "Copy and past clipboard files here" in an Add Attachment Pop up. Any OOB is there or how can we make it

#portal #widget

1 ACCEPTED SOLUTION

lauri457
Giga Sage

You can actually see in the DOM (and in the controller that calls the modal) that the modal template comes from the file "sp_attachment_modal.html" and that it actually has a ng-if directive that shows the supported extensions

<script type="text/ng-template" id="sp_attachment_modal.html"><div class="modal-attachment-picker">
<div class="modal-attachment-picker">
    <div class="modal-attachment-picker__header">
        <h1 class="attachment-header-title modal-attachment-picker__header-title h4" id="attachment-header-title">Add
            no viruses</h1><button type="button" class="close pull-right" ng-click="$dismiss()" title="Close modal"
            data-toggle="tooltip" data-placement="bottom" aria-label="Close modal" autofocus="autofocus">×</button>
    </div>
    <div class="attachment-body modal-attachment-picker__body"><sp-attachment-picker
            on-file-pick="fileSelectHandler($files)" ng-show="!loadingIndicator"></sp-attachment-picker>
        <div class="modal-attachment-picker__progress-info" ng-show="loadingIndicator"><progress
                class="modal-attachment-picker__progress"></progress><label>Uploading</label></div>
        <div ng-if="supportedExtensions !== ''" ng-show="!loadingIndicator" class="modal-attachment-picker__supported">
            <span>Supported:</span><span class="break-all">{{supportedExtensions}}</span></div>
    </div>
</div>
</script>

lauri457_1-1761282540602.png

 

So you can either create an angular ng-template (related list on widgets) with ID sp_attachment_modal.html and do your alterations in the template to override whatever you want in this modal.

 

Or add an attribute called supported-extensions with a string of your wanted extensions to your spAttachmentButton directive in your widget template

<sp-attachment-button modal="true" supported-extensions="exe, bat, sh"></sp-attachment-button> 

 

 

View solution in original post

5 REPLIES 5

lauri457
Giga Sage

You can actually see in the DOM (and in the controller that calls the modal) that the modal template comes from the file "sp_attachment_modal.html" and that it actually has a ng-if directive that shows the supported extensions

<script type="text/ng-template" id="sp_attachment_modal.html"><div class="modal-attachment-picker">
<div class="modal-attachment-picker">
    <div class="modal-attachment-picker__header">
        <h1 class="attachment-header-title modal-attachment-picker__header-title h4" id="attachment-header-title">Add
            no viruses</h1><button type="button" class="close pull-right" ng-click="$dismiss()" title="Close modal"
            data-toggle="tooltip" data-placement="bottom" aria-label="Close modal" autofocus="autofocus">×</button>
    </div>
    <div class="attachment-body modal-attachment-picker__body"><sp-attachment-picker
            on-file-pick="fileSelectHandler($files)" ng-show="!loadingIndicator"></sp-attachment-picker>
        <div class="modal-attachment-picker__progress-info" ng-show="loadingIndicator"><progress
                class="modal-attachment-picker__progress"></progress><label>Uploading</label></div>
        <div ng-if="supportedExtensions !== ''" ng-show="!loadingIndicator" class="modal-attachment-picker__supported">
            <span>Supported:</span><span class="break-all">{{supportedExtensions}}</span></div>
    </div>
</div>
</script>

lauri457_1-1761282540602.png

 

So you can either create an angular ng-template (related list on widgets) with ID sp_attachment_modal.html and do your alterations in the template to override whatever you want in this modal.

 

Or add an attribute called supported-extensions with a string of your wanted extensions to your spAttachmentButton directive in your widget template

<sp-attachment-button modal="true" supported-extensions="exe, bat, sh"></sp-attachment-button>