【ServiceNow】UI Action의 버튼의 색을 바꾼다
5635 단어 ServiceNow
UI Action
UI Action은 NowPlatform의 버튼과 링크입니다.
이것을 트리거로서 Workflow나 Task의 상태 천이에 비치므로, 구현상 필수입니다.
이번에는 UI Action을 채색합니다.
완성 이미지

이것을

이렇게!
구현
1.client script 만들기
system definition > client script로 이동합니다.
client script 테이블에서 New를 클릭합니다.

name:change button color
table:incident
type:onLoad
script:
changeButtonColor.jsfunction onLoad() {
//resolve incidentボタンの色を変える
changeButtonColor('resolve_incident', '#f0f8ff');
//aaaaaaaaaボタンの色を変える
changeButtonColor('aaa', '#ffffe0');
}
//第一引数:buttonID=>UI ActionでのAction nameの値,を指定
//第二引数:カラーコードを指定
//カラーコード:https://www.colordic.org/
function changeButtonColor(buttonID, backgroundColor) {
try{
//buttonIDからbuttonを特定して 背景色を変更
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
elmt.style.color = '#ffffff'; //ボタンのテキスト色を変更
});
}catch(e){}
}
이제 클라이언트 스크립트는 구현 OK
changeButtonColor()의 첫 번째 인수인 UI Action의 Action name은 아래와 같습니다!

2) 클라이언트 스크립트의 글로벌 적용 설정
클라이언트 스크립트를 작성하는 것만으로는 실행되지 않고, 아래의 info message가 표시되기 때문에, 또 하나 순서를 밟는다.
New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script"field To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals"to false.
클라이언트 스크립트의 적용 범위를 Isolate->Global로 변경해야 한다.
client script 의 리스트 레이아웃으로부터 Isolate script 를 true/false 로 설정할 수 있으므로, false 로 한다.

이것으로 완성! 아래와 같이! 착색 방법은 응용이 편리하므로 다양한 장면에서 이용하십시오.

참고문헌
1) 커뮤니티

이것을

이렇게!
구현
1.client script 만들기
system definition > client script로 이동합니다.
client script 테이블에서 New를 클릭합니다.

name:change button color
table:incident
type:onLoad
script:
changeButtonColor.jsfunction onLoad() {
//resolve incidentボタンの色を変える
changeButtonColor('resolve_incident', '#f0f8ff');
//aaaaaaaaaボタンの色を変える
changeButtonColor('aaa', '#ffffe0');
}
//第一引数:buttonID=>UI ActionでのAction nameの値,を指定
//第二引数:カラーコードを指定
//カラーコード:https://www.colordic.org/
function changeButtonColor(buttonID, backgroundColor) {
try{
//buttonIDからbuttonを特定して 背景色を変更
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
elmt.style.color = '#ffffff'; //ボタンのテキスト色を変更
});
}catch(e){}
}
이제 클라이언트 스크립트는 구현 OK
changeButtonColor()의 첫 번째 인수인 UI Action의 Action name은 아래와 같습니다!

2) 클라이언트 스크립트의 글로벌 적용 설정
클라이언트 스크립트를 작성하는 것만으로는 실행되지 않고, 아래의 info message가 표시되기 때문에, 또 하나 순서를 밟는다.
New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script"field To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals"to false.
클라이언트 스크립트의 적용 범위를 Isolate->Global로 변경해야 한다.
client script 의 리스트 레이아웃으로부터 Isolate script 를 true/false 로 설정할 수 있으므로, false 로 한다.

이것으로 완성! 아래와 같이! 착색 방법은 응용이 편리하므로 다양한 장면에서 이용하십시오.

참고문헌
1) 커뮤니티
function onLoad() {
//resolve incidentボタンの色を変える
changeButtonColor('resolve_incident', '#f0f8ff');
//aaaaaaaaaボタンの色を変える
changeButtonColor('aaa', '#ffffe0');
}
//第一引数:buttonID=>UI ActionでのAction nameの値,を指定
//第二引数:カラーコードを指定
//カラーコード:https://www.colordic.org/
function changeButtonColor(buttonID, backgroundColor) {
try{
//buttonIDからbuttonを特定して 背景色を変更
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
elmt.style.color = '#ffffff'; //ボタンのテキスト色を変更
});
}catch(e){}
}
1) 커뮤니티
2) 컬러 코드:
Reference
이 문제에 관하여(【ServiceNow】UI Action의 버튼의 색을 바꾼다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yasutaka_ono/items/2d8c3ef2ed5101e3d629텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)