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

GlideFather
Tera Patron

Hi @AlwinJebakY,

it's not clear to me.. do you want to add the attachment section to your form, hide it, enable drag and drop, enabled/disable any specific file formats or what exactly is your requirement?

 

Sorry, but I need to understand your struggle before giving you and meaningful suggestion..

 

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @GlideFather 

AlwinJebakY_0-1761230885016.png


This Add Attachment Pop up is shown in Portal, I need to Add list of accepted files format below the Add Attachments Title

AlwinJebakY_0-1761231026257.png

Hi @GlideFather 

See this Screenshot, This Screenshot from Service Portal
Here i need to add the Supported attachment file formats like .jpg, .pdf  below the Add Attachment Title 

Any OOB is there or how we can do it

AlwinJebakY
Tera Expert

AlwinJebakY_0-1761231659596.png


See this Screenshot, It was taken from Portal
My Expectation is need to show the list of accepted attachments on below the Add Attachments Title
Like Accepted formats are .jpg, .pdf etc.,

Is there any OOB is there or how to customize it?