수정 스크립트를 실행하여 서비스에 대해 10진수 수량 활성화

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 3분
  • Yokohama 패치 12 또는 Zurich 패치 6으로 업그레이드한 후 서비스에 대해 10진수 수량을 지정할 수 없는 경우 백그라운드 수정 스크립트를 실행하여 10진수 수량에 대한 지원을 활성화해야 합니다.

    시작하기 전에

    필요한 역할: sn_shop.procurement_administrator

    이 태스크 정보

    Yokohama 패치 12 또는 Zurich 패치 6으로 업그레이드했으며 서비스에 대해 10진수 수량을 지정할 수 없는 경우 스크립트 - 백그라운드 모듈에서 이 스크립트를 실행합니다. 스크립트는 수량 필드 유형을 정수에서 소수로 변환하고 필드 배율을 소수점 이하 4자리로 업데이트합니다.

    프로시저

    1. 다음으로 이동 모두 > 시스템 정의 > 스크립트 - 백그라운드.
    2. 스크립트 실행(서버에서 실행된 JavaScript) 섹션에 다음 코드를 붙여 넣습니다.
      (function() {
         var tableName = 'sn_spend_sdc_service_request_line';
         var columnName = 'new_purchased_quantity';
         if (pm.isZboot()) {
             return;
         }
         try {
             var updated = GlideFixStuff.fixTypeFromIntegerToDecimalCaseLineQuantityItem(tableName, columnName);
             if (!updated) {
                 gs.info('Cannot update type from integer to decimal for field ' + columnName);
                 return;
             }
             updateScale();
         } catch (ex) {
             gs.info('Cannot update type from integer to decimal with error ' + JSON.stringify(ex));
             return;
         }
         function updateScale() {
             var desiredScale = 4;
             var dictGR = new GlideRecord('sys_dictionary');
             var query = 'name=' + tableName + '^elementIN' + columnName;
             var fieldName;
             dictGR.addEncodedQuery(query);
             dictGR.query();
             if (dictGR.next()) {
                 try {
                     var attrbiuteArray = [];
                     var currentAttributes = dictGR.attributes;
                     if (currentAttributes != '') {
                         attrbiuteArray = currentAttributes.split(',');
                     }
                     var currentMaxLength = dictGR.max_length;
                     fieldName = dictGR.element;
                     var newMaxLength = currentMaxLength + desiredScale;
                     dictGR.max_length = newMaxLength;
                     attrbiuteArray.push("scale=" + desiredScale);
                     dictGR.attributes = attrbiuteArray.join(',');
                     dictGR.update();
                     dictGR.max_length = newMaxLength + 1;
                     dictGR.update();
                     gs.info('Updated max length twice for field ' + fieldName);
                 } catch (ex) {
                     gs.info('Cannot update scale attribute due to error : ' + JSON.stringify(ex));
                     gs.error('Error updating max length attribute for field {0}. No update performed.', fieldName);
                 }
             }
         }
      })();
    3. 롤백할 기록의 선택을 취소하시겠습니까? 확인란.
    4. 스크립트 실행을 선택합니다.