Skip to content

Commit ff54be1

Browse files
authored
Merge branch 'ServiceNowDevProgram:main' into main
2 parents c03f587 + d2e95cc commit ff54be1

File tree

28 files changed

+592
-99
lines changed

28 files changed

+592
-99
lines changed

Client-Side Components/Catalog Client Script/Strong Username Validation Script/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

Client-Side Components/Client Scripts/Allow positive and decimal values/Allow positive and decimal values.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

Client-Side Components/Client Scripts/Allow positive and decimal values/readme.md

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<j:jelly trim="false"
3+
xmlns:j="jelly:core"
4+
xmlns:g="glide"
5+
xmlns:j2="null"
6+
xmlns:g2="null">
7+
<style>
8+
.touch_scroll{
9+
background:url("/formbg.png");
10+
background-size:cover;
11+
background-position:center;
12+
}
13+
label{
14+
font-weight:600;
15+
font-size:16px;
16+
17+
}
18+
.btn-default{
19+
background:#fff;
20+
}
21+
table,form,.section,.tabs2_section {
22+
background:transparent !important;
23+
}
24+
</style>
25+
</j:jelly>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# ServiceNow Form Background Macro
2+
3+
> A lightweight UI Macro to style ServiceNow forms with a custom background and simple element theming (labels, buttons, sections).
4+
---
5+
6+
## Features
7+
8+
* Adds a full-cover background image to a form (supports cover, center positioning).
9+
* Makes table/form/section backgrounds transparent so the background shows through.
10+
* Easy to customize (image path, label styles, button styles, additional CSS selectors).
11+
12+
## Requirements
13+
14+
* ServiceNow instance with admin access.
15+
* An image to set as background
16+
17+
> ⚠️ Note: This macro uses Jelly/CSS that may not work as expected in some Next Experience workspaces or future UI updates. Test in a non-production instance first.
18+
19+
## Installation
20+
21+
1. **Upload the background image**
22+
23+
* Navigate to **System UI > Images** and upload your background image (e.g., `formbg.png`).
24+
25+
2. **Create the UI Macro**
26+
27+
* Go to **System UI > UI Macros** and create a new macro (e.g., `ui_form_background`).
28+
* Copy the example macro content below into the UI Macro.
29+
30+
3. **Create a UI Formatter**
31+
32+
* Go to **System UI > Formatters**. Create a new formatter for the target table (for example, `incident` table).
33+
* In the *Formatter* field, reference the macro name you created (e.g., `ui_form_background.xml`).
34+
35+
4. **Add the Formatter to the Form Layout**
36+
37+
* Open the form layout for the target table (Form Layout / Form Designer) and place the formatter region on the form.
38+
* Save and open a record to see the background applied.
39+
40+
## Compatibility
41+
42+
* Tested on ServiceNow classic forms (UI16). May require tweaks for Next Experience, Service Portal, or Workspace.
43+
* If your instance uses strict Content Security Policy (CSP) or image hosting constraints, host the image in a supported location or adapt the implementation.
44+
45+
## Troubleshooting
46+
47+
* If no background appears:
48+
49+
* Confirm the image is uploaded and the filename matches.
50+
* Ensure the formatter is placed on the form layout and published.
51+
* Inspect (browser devtools) to confirm CSS selectors are applied.
52+
53+
## Result
54+
<img width="1838" height="922" alt="image" src="https://github.com/user-attachments/assets/14c29e0a-ad88-411e-b7ca-1c82eaeaf324" />
55+

GlideFilter/CaseSensitiveSearch/Normalize_All_Variants_of_prod.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

GlideFilter/CaseSensitiveSearch/README.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Attachment variable widget
2+
3+
This widget lets you use the oob attachment picker from the oob catalog item widget as a custom type variable giving you more control over attachment behaviour, you can for example use ui policies to hide and show the attachment picker.
4+
5+
## Usage example
6+
7+
Create new widget [sp_widget]
8+
Copy template.html in the Body HTML template field
9+
Copy controller.js in the Client controller field
10+
Add custom type variable using newly created widget positioned as last variable
11+
Set hide attachment for catalog item as true
12+
Open cat item in portal and adjust widget as needed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
api.controller = function ($scope, nowAttachmentHandler, spUtil, spAttachmentUpload, $timeout, cabrillo, spModal) {
2+
var c = this;
3+
c.isNative = cabrillo.isNative()
4+
/*
5+
* change table and guid if you want to attach to some other record
6+
*/
7+
$scope.table = $scope.page.g_form.recordTableName;
8+
$scope.guid = $scope.$parent.c.getAttachmentGuid();
9+
//
10+
$scope.data.maxAttachmentSize = 24;
11+
var ah = $scope.attachmentHandler = new nowAttachmentHandler(setAttachments, appendError);
12+
ah.setParams($scope.table, $scope.guid, 1024 * 1024 * $scope.data.maxAttachmentSize);
13+
14+
// implement logic to show drag and drop picker or clip icon with text
15+
$scope.showDragAndDrop = function () {
16+
if (true)
17+
return true;
18+
else
19+
return false;
20+
}
21+
/*
22+
* callback function called after attachment action happens
23+
* e.g. implement mandatory attachment
24+
*/
25+
function setAttachments(attachments, action) {
26+
if (!angular.equals($scope.attachments, attachments))
27+
$scope.attachments = attachments;
28+
if (action === "added") {
29+
// custom attachment added logic
30+
}
31+
if (action === "renamed") {
32+
// custom attachment renamed logic
33+
}
34+
if (action === "deleted") {
35+
// custom attachment deleted logic
36+
}
37+
spUtil.get($scope, {
38+
action: "from_attachment"
39+
});
40+
}
41+
/*
42+
* callback function called on error
43+
*/
44+
function appendError(error) {
45+
spUtil.addErrorMessage(error.msg + error.fileName);
46+
}
47+
48+
// drag & drop handler
49+
$scope.dropFiles = function (files) {
50+
if (files && files.length > 0) {
51+
$scope.attachmentUploadInProgress = true;
52+
$scope.totalFilesBeingUploaded++;
53+
spAttachmentUpload.uploadAttachments($scope.attachmentHandler, files);
54+
}
55+
$timeout(function () {
56+
if ($scope.attachmentUploadInProgress != false)
57+
spUtil.addInfoMessage("The attachment upload is in progress. Note that some actions are deactivated during the file upload process");
58+
}, 2000);
59+
$scope.$on('attachment.upload.idle', function () {
60+
$scope.attachmentUploadInProgress = false;
61+
$scope.totalFilesBeingUploaded = 0;
62+
});
63+
};
64+
//confirm delete dialog
65+
$scope.confirmDeleteAttachment = function (attachment) {
66+
if (c.isNative) {
67+
if (confirm("delete attachment?")) {
68+
$scope.data.attachment_action_in_progress = true;
69+
$scope.attachmentHandler.deleteAttachment(attachment);
70+
}
71+
} else {
72+
spModal.confirm("delete attachment?").then(function () {
73+
$scope.data.attachment_action_in_progress = true;
74+
$scope.attachmentHandler.deleteAttachment(attachment);
75+
});
76+
}
77+
}
78+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<div ng-if="true" class="wrapper-md row no-margin" role="region" data-label="Attachments"
2+
aria-label="${Attachments}">
3+
<div
4+
ng-class="{'flex-center attachment-height': c.isNative == 'true', 'flex-start': c.isNative != 'true'}">
5+
<div ng-if="!submitting && !submitted" style="font-weight:normal;cursor:default;margin-bottom:2rem;">
6+
<sp-attachment-button ng-if="::!showDragAndDrop()" modal="true"
7+
required="{{data.mandatory_attachment}}"></sp-attachment-button>
8+
<sp-attachment-button ng-if="::showDragAndDrop()" modal="true"
9+
required="{{data.mandatory_attachment}}"
10+
ng-class="{'hidden-xs': false, 'hidden-sm': true, 'hidden-md': true, 'hidden-lg': true}"></sp-attachment-button>
11+
<span class="fa fa-asterisk mandatory" ng-if="data.mandatory_attachment"
12+
ng-class="{'mandatory-filled': data.mandatory_attachment && (data.attachment_submitted || attachments.length > 0)}"
13+
style="vertical-align:super" aria-hidden="true"></span>
14+
<span ng-class="{'attachment-text' : options.native_mobile == 'true'}" aria-hidden="true">${Add
15+
attachments}</span>
16+
</div>
17+
</div>
18+
<div ng-if="::showDragAndDrop()" class="panel panel-{{options.color}} b drag-and-drop-area"
19+
ng-class="{'hidden-xs': true}" aria-hidden="true">
20+
<sp-attachment-picker on-file-pick="dropFiles($files)"></sp-attachment-picker>
21+
</div>
22+
<span ng-if="attachmentUploadInProgress">
23+
${Uploading attachments}
24+
<div class="sp-loading-indicator la-sm" style="color:black;display:inline">
25+
<div></div>
26+
<div></div>
27+
<div></div>
28+
</div>
29+
</span>
30+
<now-attachments-list template="sp_attachment_single_line"></now-attachments-list>
31+
</div>

0 commit comments

Comments
 (0)