GlideElement - 전역

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 67분
  • GlideElement API는 필드와 해당 값을 처리하기 위한 여러 가지 편리한 스크립트 메서드를 제공합니다. 현재 Glide 기록의 필드에는 GlideElement 메서드를 사용할 수 있습니다.

    GlideElement - canCreate()

    사용자의 역할에서 연결된 필드에 새 항목을 만들 수 있는지 여부를 결정합니다.

    표 1. 매개변수
    이름 유형 설명
    안 함
    표 2. 반환
    유형 설명
    부울 현재 사용자에게 연결된 필드에 새 항목을 작성할 수 있는 권한이 있는지 여부를 나타내는 플래그입니다.
    가능한 값:
    • true: 사용자가 새 항목을 생성할 수 있습니다.
    • 아니오: 사용자가 새 항목을 만들 수 없습니다.

    다음 예는 사용자에게 문제 [problem] 테이블의 최근 기록 3개에 대한 항목을 생성할 수 있는 권한이 있는지 확인하는 방법을 보여줍니다.

    var gr = new GlideRecord('problem');
    
    // Get records in new state in Problem Table
    gr.addQuery('state','101');
    
    // Sort records in order of recent to earlier Created Date
    gr.orderByDesc('sys_created_on');
    
    // Limit the query to three records
    gr.setLimit(3); 
    gr.query();
    
    while(gr.next()){
      if(gr.short_description.canCreate()){ ///check to see if the current user is allowed to create the record
      gs.info("I can create new records for the field Problem statement for - " + gr.number);
      }
    }

    출력:

    I can create new records for the field Problem statement for - PRB0000004
    I can create new records for the field Problem statement for - PRB0001000
    I can create new records for the field Problem statement for - PRB0001001

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 canCreate() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 canCreate()를 사용합니다.

    GlideElement - canRead()

    사용자의 역할에서 연결된 GlideRecord를 읽을 수 있는지 여부를 결정합니다.

    표 3. 매개변수
    이름 유형 설명
    안 함
    표 4. 반환
    유형 설명
    부울 필드를 읽을 수 있으면 예이고 그렇지 않으면 아니오입니다.

    다음 예는 읽을 수 있는 간단한 설명 필드가 있는 활성 인시던트 기록 목록을 가져오는 방법을 보여줍니다.

    var grIncident = new GlideRecord('incident');
    grIncident.addEncodedQuery("active=true"); //Query the Incident table for active incidents
    grIncident.orderByDesc('number');
    grIncident.setLimit(3); // limit to three results for example
    grIncident.query();
    
    while (grIncident.next()) {
        if (grIncident.short_description.canRead()) { //check to see if the current user is allowed to read the record
            gs.info('You have permission to read the short description of: ' + grIncident.number + ' ' + grIncident.short_description);
        }
    }

    출력:

    *** Script: You have permission to read the short description of: INC0009009 Unable to access the shared folder.
    *** Script: You have permission to read the short description of: INC0009005 Email server is down.
    *** Script: You have permission to read the short description of: INC0009001 Unable to post content on a Wiki page

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 canRead() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 canRead()를 사용합니다.

    GlideElement - canWrite()

    사용자의 역할에서 연결된 GlideRecord에 쓸 수 있는지 여부를 결정합니다.

    표 5. 매개변수
    이름 유형 설명
    안 함
    표 6. 반환
    유형 설명
    부울 사용자가 필드에 쓸 수 있으면 예, 그렇지 않으면 아니오입니다.

    다음 예는 쓰기 가능한 간단한 설명 필드가 있는 활성 인시던트 기록 목록을 가져오는 방법을 보여줍니다.

    var grIncident = new GlideRecord('incident');
    grIncident.addEncodedQuery("active=true"); //Query the Incident table for active incidents
    grIncident.orderByDesc('number');
    grIncident.setLimit(3); // limit to three results for example
    grIncident.query();
    
    while (grIncident.next()) {
        if (grIncident.short_description.canWrite()) { //check to see if the current user is allowed to write to the record
            gs.info('You have permission to write to the short description of: ' + grIncident.number + ' ' + grIncident.short_description);
        }
    }

    출력:

    *** Script: You have permission to write to the short description of: INC0009009 Unable to access the shared folder.
    *** Script: You have permission to write to the short description of: INC0009005 Email server is down.
    *** Script: You have permission to write to the short description of: INC0009001 Unable to post content on a Wiki page

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 canWrite() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 canWrite()를 사용합니다.

    GlideElement - 변경 사항()

    현재 필드가 수정되었는지 여부를 결정합니다. 이 기능은 저널 필드를 제외하고 사용 가능한 모든 데이터 유형에 사용할 수 있습니다.

    주:
    changes() 메서드는 ACL 스크립트 내에서 지원되지 않습니다.
    주:
    이 메서드를 수행하는 GlideRecord가 초기화 및 읽기만 되고 쓰기되지 않은 경우 기본 전후 값은 동일합니다. 이 경우 데이터 저장소가 변경되지 않았으므로 메서드는 "false"를 반환합니다.
    비즈니스 규칙 실행
    ServiceNow AI Platform 열(GlideElement 객체)의 내부 이전 값을 현재 값으로 재설정하기 전에 비즈니스 규칙(BEFORE 또는 AFTER)을 호출합니다.
    이 시퀀스를 사용하면 다음 작업을 수행할 수 있습니다.
    • <column>.changes 조건에서 비즈니스 규칙을 트리거합니다 AFTER .
    • 스크립트 섹션의 이전 GlideRecord 객체에 액세스
    비즈니스 규칙에서도 AFTERcurrent.<field>.changes() 는 내부 이전 값이 아직 재설정되지 않았기 때문에 true 를 반환합니다. current.<field>.value != previous.<field>.value 조건도 true를 반환합니다.
    이전 값은 다음 활동 후에만 재설정됩니다.
    • 데이터베이스 업데이트가 완료되었습니다.
    • 모든 AFTER 비즈니스 규칙이 처리되었습니다.

    AFTER 비즈니스 규칙 내에서 필드 값이 수정되면 changes() 메서드는 업데이트 후 규칙이 실행되더라도 여전히 true 를 반환합니다.

    표 7. 매개변수
    이름 유형 설명
    안 함
    표 8. 반환
    유형 설명
    부울 필드가 변경되면 True, 그렇지 않으면 False입니다.

    비즈니스 규칙의 다음 예는 assigned_to 필드의 값이 변경될 경우 EventQueue에서 이벤트를 만드는 방법을 보여줍니다. 포괄적인 예는 다음 문서를 참조하십시오 Sample scripts from the change events business rule.

    if (!current.assigned_to.nil() && current.assigned_to.changes()) {
      gs.eventQueue('incident.assigned', current, current.assigned_to.getDisplayValue(), previous.assigned_to.getDisplayValue());
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 changes() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 changes()를 사용합니다.

    GlideElement - changesFrom(객체 값)

    현재 필드의 이전 값이 지정된 객체와 일치하는지 여부를 결정합니다.

    주:
    이 메서드를 수행하는 GlideRecord가 초기화 및 읽기만 되고 쓰기되지 않은 경우 기본 전후 값은 동일합니다. 이 경우 데이터 저장소가 변경되지 않았으므로 메서드는 "false"를 반환합니다.
    표 9. 매개변수
    이름 유형 설명
    객체 현재 필드의 이전 값과 비교하여 확인할 객체 값입니다.
    표 10. 반환
    유형 설명
    부울 이전 값이 매개변수와 일치하면 True이고 그렇지 않으면 False입니다.
    if (theState.changesTo(resolvedState)) {
      operation = 4; //Resolved
    }
    else if (theState.changesTo(closedState)) {
      operation = 11; //Resolution Accepted
    }
    else if (theState.changesFrom(resolvedState) || theState.changesFrom(closedState)) {
      operation = 10; //Re-open
    }
    else {
      operation = 6; //Update
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 changesFrom() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 changesFrom()을 사용합니다.

    GlideElement - changesTo(객체 값)

    변경 후 필드의 새 값이 지정된 객체와 일치하는지 여부를 결정합니다.

    주:
    changesTo() 메서드는 ACL 스크립트 내에서 지원되지 않습니다.
    주:
    이 메서드를 수행하는 GlideRecord가 초기화 및 읽기만 되고 쓰기되지 않은 경우 기본 전후 값은 동일합니다. 이 경우 데이터 저장소가 변경되지 않았으므로 메서드는 "false"를 반환합니다.
    표 11. 매개변수
    이름 유형 설명
    객체 현재 필드의 새 값과 비교하여 확인할 객체 값입니다.
    표 12. 반환
    유형 설명
    부울 새 값이 매개변수와 일치하면 True이고 그렇지 않으면 False입니다.
    if (theState.changesTo(resolvedState)) {
      operation = 4; //Resolved
    }
    else if (theState.changesTo(closedState)) {
      operation = 11; //Resolution Accepted
    }
    else if (theState.changesFrom(resolvedState) || theState.changesFrom(closedState)) {
      operation = 10; //Re-open
    }
    else {
      operation = 6; //Update
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 changesTo() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 changesTo()를 사용합니다.

    GlideElement - dateNumericValue()

    기간 필드에 대해 1970년 1월 1일 00:00:00 GMT 이후의 밀리초 수를 반환합니다. 기간 필드가 이미 GlideDateTime 객체이므로 GlideDateTime 객체를 생성할 필요가 없습니다.

    표 13. 매개변수
    이름 유형 설명
    안 함
    표 14. 반환
    유형 설명
    번호 1970년 1월 1일 00:00:00 GMT 이후의 밀리초 수입니다.
    var inc = new GlideRecord('incident');
    inc.get('17c90efb13418700cc36b1422244b05d');
    gs.info(inc.calendar_duration.dateNumericValue());

    출력: 98000

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 dateNumericValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 dateNumericValue()를 사용합니다.

    GlideElement - 디버그(객체 o)

    객체를 디버그하고 setError(String)를 사용하여 디버그 메시지를 추가합니다.

    표 15. 매개변수
    이름 유형 설명
    o 객체 디버그할 객체입니다.
    표 16. 반환
    유형 설명
    안 함

    GlideElement - getAttribute(String attributeName)

    딕셔너리에서 지정된 속성의 값을 반환합니다.

    부울 속성의 경우 getBooleanAttribute() 메서드를 사용하여 문자열 대신 부울로 값을 반환할 수 있습니다.

    표 17. 매개변수
    이름 유형 설명
    attributeName 문자열 속성의 이름입니다. 속성 이름은 딕셔너리 항목 [sys_dictionary] 테이블에 나열됩니다.
    표 18. 반환
    유형 설명
    문자열 지정된 속성의 값입니다.

    다음 예제에서는 사용자 [sys_user] 테이블의 열에 있는 location 속성 값을 tree_picker 문자열로 가져오는 방법을 보여 줍니다.

    var now_GR = new GlideRecord('sys_user');
    now_GR.query("user_name","admin");
    
    if (now_GR.next()) {
       gs.info("The value of the tree_picker attribute in the location column is " + now_GR.location.getAttribute("tree_picker"));
    }

    출력:

    The value of the tree_picker attribute in the location column is true

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getAttribute() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getAttribute()를 사용합니다.

    GlideElement - getBaseTableName()

    필드의 기본 테이블을 가져옵니다.

    표 19. 매개변수
    이름 유형 설명
    안 함
    표 20. 반환
    유형 설명
    문자열 기본 테이블의 이름입니다. 이 이름은 필드가 정의된 테이블과 다를 수 있습니다. 제품 설명서를 참조하십시오 Table extension and classes .

    다음 예는 인시던트 기록의 할당 그룹 필드에 대한 기본 테이블을 설정하는 방법을 보여줍니다.

    var gr = new GlideRecord('incident');
    
    //query the Incident Records which have category as Inquiry/Help
    gr.addQuery('category','inquiry');
    
    // sort them in the order of earlier to recent created date
    gr.orderBy('sys_created_on');
    gr.query();
    
    if(gr.next()){ //If at least any one record exists matching this query
    
      //Print the base table for the Assignment Group field
      gs.print("The Base Table for the field Assignment Group is - " + gr.assignment_group.getBaseTableName()); 
    };

    출력:

    The Base Table for the field Assignment Group is - task

    GlideElement - getBooleanAttribute(String attributeName)

    사전에서 지정된 부울 유형 속성을 부울 값으로 반환합니다.

    속성 값을 문자열로 반환하려면 getAttribute() 메서드를 사용합니다.

    표 21. 매개변수
    이름 유형 설명
    attributeName 문자열 속성의 이름입니다. 속성 이름은 딕셔너리 항목 [sys_dictionary] 테이블에 나열됩니다.
    표 22. 반환
    유형 설명
    부울 속성 값을 부울 true 또는 false로 지정합니다.

    다음 예제에서는 두 필드에 대한 속성의 ignore_filter_on_new 부울 값을 가져오는 방법을 보여줍니다.

    var inc = new GlideRecord('incident');
    inc.query();
    
    if (inc.next())
     {
       // opened_by field has attribute "ignore_filter_on_new = true"
       gs.info(inc.opened_by.getBooleanAttribute("ignore_filter_on_new"));
    
      // short_description field does not have attribute ignore_filter_on_new
       gs.info(inc.short_description.getBooleanAttribute("ignore_filter_on_new"));
     }

    출력:

    true
    false

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getBooleanAttribute() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getBooleanAttribute()를 사용합니다.

    GlideElement - getChoices(문자열에 따라 다름)

    필드에 대한 선택 목록을 생성합니다. 확장 테이블이 아닌 기본 테이블의 선택 값만 반환합니다.

    표 23. 매개변수
    이름 유형 설명
    종속 문자열 옵션입니다. 선택 목록 필드가 종속된 연결된 기록 내의 필드입니다.
    표 24. 반환
    유형 설명
    배열 목록 필드에 대한 선택 값입니다.
    var glideRecord = new GlideRecord('incident'); 
    glideRecord.query('priority','1'); 
    glideRecord.next(); 
     
    // urgency has choice list: 1 - High, 2 - Medium, 3 - Low, with value: 1, 2, 3
    var choices = glideRecord.urgency.getChoices();

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getChoices() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getChoices()를 사용합니다.

    GlideElement - getChoiceValue()

    현재 선택 값에 대한 선택 레이블을 가져옵니다.

    표 25. 매개변수
    이름 유형 설명
    안 함
    표 26. 반환
    유형 설명
    문자열 선택 레이블입니다.

    다음 예는 우선순위 값이 일반인 변경 요청 기록에 대한 선택 레이블을 가져오는 방법을 보여줍니다.

    var gr = new GlideRecord('change_request');
    
    //query for the change records with change type as "Normal"
    gr.addQuery('type','normal');
    
    // sort them in the order of recent to earlier Created Date
    gr.orderByDesc('sys_created_on'); 
    
    // limit the query to 4 records
    gr.setLimit(4); 
    gr.query();
    
    while(gr.next()){
     //Printing the choice label for those records
     gs.print("The label of the current priority '"+ gr.priority+"' for the change request - " + gr.number + " is - "+ gr.priority.getChoiceValue()); 
    }

    출력:

    The label of the current priority '4' for the change request - CHG0000014 is - 4 - Low
    The label of the current priority '4' for the change request - CHG0000013 is - 4 - Low
    The label of the current priority '4' for the change request - CHG0000012 is - 4 - Low
    The label of the current priority '4' for the change request - CHG0000011 is - 4 - Low

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getChoiceValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getChoiceValue()를 사용합니다.

    GlideElement - getDebugCount()

    debug()에 의해 기록된 디버그 메시지 수를 가져옵니다.

    표 27. 매개변수
    이름 유형 설명
    안 함
    표 28. 반환
    유형 설명
    번호 디버그 메시지 수입니다.

    GlideElement - getDependent()

    지정된 필드가 종속된 필드(요소)를 반환합니다.

    표 29. 매개변수
    이름 유형 설명
    안 함
    표 30. 반환
    유형 설명
    문자열 현재 필드가 종속된 필드의 이름입니다. 의존성이 없는 경우 Null입니다.

    다음 예제는 getDependent() 메서드를 사용하여 구성 항목 필드의 상위 필드를 찾는 방법을 보여줍니다.

    var inc_gr = new GlideRecord('incident');
    inc_gr.get('985f53d82fab301032e8808cf699b6e8'); // Get a particular Incident
    
    var field_element = inc_gr.getElement('cmdb_ci'); // Get the Configuration Item element
    var dependent_field = field_element.getDependent(); // Read the dependent field
    gs.info("Dependent field: " + dependent_field);
    if(dependent_field)
      {
        var dependent_field_value = inc_gr.getValue(dependent_field);  
        if(!dependent_field_value)
          {
            var base_table = field_element.getRefRecord(); // Retrieve the reference record
            var dependent_field_value = base_table.getValue(dependent_field); // Read the parent field value
          }
        inc_gr.setValue(dependent_field, dependent_field_value); // Update the parent field on the Incident
        inc_gr.update();
      }

    출력:

    company

    GlideElement - getDependentTable()

    필드가 종속된 테이블의 이름을 반환합니다.

    표 31. 매개변수
    이름 유형 설명
    안 함
    표 32. 반환
    유형 설명
    문자열 필드에 종속 테이블이 있는 경우의 테이블 이름입니다. 그렇지 않으면 null입니다.

    다음 예제에서는 이름이 지정된 model_id 필드에 종속 테이블이 있는지 확인하는 방법을 보여줍니다.

    var gr = new GlideRecord('cmdb_ci_hardware');
    gr.setLimit(1);
    gr.query();
    
    if (gr.next()) {
        var field_element = gr.getElement('model_id'); // Get the model_id field element
        var dependent_table = field_element.getDependentTable(); // Get the table that drives filtering
    
        gs.info("Field: " + field_element.getLabel());
        gs.info("Dependent table: " + dependent_table); // cmdb_model_category
    
        if (dependent_table) {
            // Use the dependent table to query what's controlling the filter
            var dep_gr = new GlideRecord(dependent_table);
            if (dep_gr.get(gr.getValue('model_category'))) {
                gs.info("Controlling record: " + dep_gr.getDisplayValue());
                gs.info("Only models belonging to category '" + dep_gr.getDisplayValue() + "' are valid for this CI");
            }
        }
    }

    출력:

    Field: Model ID
    Dependent table: null

    GlideElement - getDisplayValue(Number maxChar)

    필드의 형식화된 표시 값을 반환합니다.

    표시 값은 데이터베이스, 사용자 또는 시스템 설정과 기본 설정의 실제 값을 기반으로 조작됩니다.

    반환되는 표시 값은 필드 유형에 따라 다릅니다.
    • 선택 필드: 데이터베이스 값은 숫자일 수 있지만 표시 값은 더 자세히 설명할 수 있습니다.
    • 날짜 필드: 데이터베이스 값은 UTC 형식이고 표시 값은 사용자의 시간대를 기준으로 합니다.
    • 암호화된 텍스트: 데이터베이스 값은 암호화되고 표시된 값은 사용자의 암호화 컨텍스트에 따라 암호화되지 않습니다.
    • 참조 필드: 데이터베이스 값은 sys_id지만 표시 값은 참조된 기록의 표시 필드입니다.
    표 33. 매개변수
    이름 유형 설명
    maxChar 번호 옵션입니다. 반환할 최대 문자 수입니다.
    표 34. 반환
    유형 설명
    문자열 필드의 표시 값입니다.
    var fields = current.getFields();
    for (var i = 0; i < fields.size(); i++) { 
      var field = fields.get(i);
      var name = field.getName(); 
      var value = field.getDisplayValue(); 
      gs.print(i + ". " + name + "=" + value); 
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getDisplayValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getDisplayValue()를 사용합니다.

    GlideElement - getDisplayValueExt(Number maxChar, string nullSub)

    필드의 형식화된 표시 값을 반환하거나 표시 값이 null이거나 비어 있는 경우 지정된 대체 값을 반환합니다.

    표시 값은 데이터베이스, 사용자 또는 시스템 설정과 기본 설정의 실제 값을 기반으로 조작됩니다.

    반환되는 표시 값은 필드 유형에 따라 다릅니다.
    • 선택 필드: 데이터베이스 값은 숫자일 수 있지만 표시 값은 더 자세히 설명할 수 있습니다.
    • 날짜 필드: 데이터베이스 값은 UTC 형식이고 표시 값은 사용자의 시간대를 기준으로 합니다.
    • 암호화된 텍스트: 데이터베이스 값은 암호화되고 표시된 값은 사용자의 암호화 컨텍스트에 따라 암호화되지 않습니다.
    • 참조 필드: 데이터베이스 값은 sys_id지만 표시 값은 참조된 기록의 표시 필드입니다.
    표 35. 매개변수
    이름 유형 설명
    maxChar 번호 옵션입니다. 반환될 최대 문자 수입니다.

    기본값: 모두

    null서브 문자열 표시 값이 null이거나 비어 있는 경우 반환할 값입니다.
    표 36. 반환
    유형 설명
    문자열 형식화된 필드 표시 값 또는 지정된 대체 값입니다.

    다음 예는 인시던트 [incident] 테이블에 가장 최근에 활성화된 두 개의 기록을 표시하는 방법을 보여줍니다.

    var gr = new GlideRecord('incident');
    gr.addQuery('active', true);      // get the active records
    gr.orderByDesc('sys_updated_on'); // sort the records from most recent to oldest updated date
    gr.setLimit(2);                   // limit the query to 2 records
    gr.query();
    
    while(gr.next()){ // Printing the Display Value of the Configuration Item field. 
      // If the Display Value is Null/Empty, then it will be substituted with Default value "I with Null/Empty Display Value"
      gs.info("The Display Value of the Configuration Item for the incident - "+ gr.number+ " is " + gr.cmdb_ci.getDisplayValueExt(40, " CI with Null/Empty Display Value"));
    }

    출력:

    The Display Value of the Configuration Item for the incident - INC0007001 is  CI with Null/Empty Display Value
    The Display Value of the Configuration Item for the incident - INC0000069 is NYC RAC

    GlideElement - getDisplayValueLang(문자열 언어)

    언어로 된 필드의 표시 값을 가져옵니다.

    결과는 선택, 번역된 필드번역된 텍스트와 같은 번역 가능한 필드 유형에만 적용할 수 있습니다. 다른 필드 유형의 경우 결과는 기본적으로 getDisplayValue()로 설정됩니다.

    번역된 값을 검색하려면 해당 언어 플러그인이 있어야 합니다. 자세한 내용은 Activate a language 문서를 참조하십시오.

    범위가 지정된 GlideElement - getLabelLang(문자열 언어) 또한 참조하십시오.

    표 37. 매개변수
    이름 유형 설명
    언어 문자열 IETF BCP-47을 준수하는 언어 태그입니다.
    표 38. 반환
    유형 설명
    문자열 전달된 언어로 된 필드의 값을 표시합니다. 번역을 사용할 수 없는 경우 메서드는 현재 사용자의 언어로 번역된 값을 검색합니다. 번역을 사용할 수 없는 경우 결과는 기본적으로 영어로 설정됩니다.

    다음 예는 수락 (UI 뷰) 제목 필드에서 원본 텍스트와 독일어 번역 텍스트를 가져오는 방법을 보여줍니다.

    var uiView = new GlideRecord("sys_ui_view");
    uiView.get("fa776f6d97700100f309124eda2975bc");
    
    gs.info("getDisplayValue: " + uiView.getElement("title").getDisplayValue());
    gs.info("getDisplayValueLang: " + uiView.getElement("title").getDisplayValueLang("de"));

    출력:

    getDisplayValue: Accept
    getDisplayValueLang: Akzeptieren

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getDisplayValueLang() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getDisplayValueLang()을 사용합니다.

    GlideElement - getDynamicAttribute()

    이 GlideElement에 대한 동적 속성 정의를 반환합니다.

    동적 속성에는 정의된 데이터 유형과 sys_id가 있습니다. 동적 속성에 대한 자세한 내용은 동적 스키마를 참조하십시오.

    표 39. 매개변수
    이름 유형 설명
    안 함
    표 40. 반환
    유형 설명
    IDynamicAttribute GlideElement가 나타내는 속성을 설명하는 객체입니다.

    다음 예는 인시던트 테이블의 u_inc_dynamic_schema 동적 속성 저장소 열에서 make 속성의 값을 가져오는 방법을 보여줍니다.

    var gr_Inc = new GlideRecord('incident');
    gr_Inc.query();
    if(gr_Inc.next()) {
        var attr = gr_Inc.getDynamicAttribute('inc_dynamic_schema->make');
        gs.info(attr.getValue());
    }

    GlideElement - getDynamicNamespace()

    GlideElement에 대해 구성된 동적 네임스페이스 객체를 반환합니다.

    동적 속성에는 정의된 데이터 유형과 sys_id가 있습니다. 동적 속성에 대한 자세한 내용은 동적 스키마를 참조하십시오.

    표 41. 매개변수
    이름 유형 설명
    안 함
    표 42. 반환
    유형 설명
    IDynamicNamespace 동적 네임스페이스를 설명하는 객체입니다.

    다음 예는 인시던트 테이블에서 inc_dynamic_schema 동적 속성 저장소 열에 대해 구성된 네임스페이스 객체를 검색하는 방법을 보여줍니다.

    var gr_Inc = new GlideRecord('incident');
    gr_Inc.query();
    if (gr_Inc.next()) {
        var ge_Make = gr_Inc.getElement('inc_dynamic_schema->make');
        var namespace = ge_Make.getDynamicNamespace();
     
        gs.info("toString:    " + namespace);
        gs.info("name:        " + namespace.getName());
        gs.info("isActive:    " + namespace.isActive());
        gs.info("isTransient: " + namespace.isTransient());
    }

    출력:

    toString:    incident/inc_dynamic_schema
    name:        incident/inc_dynamic_schema
    isActive:    true
    isTransient: false

    GlideElement - getDynamicNamespaceName()

    GlideElement에 대해 구성된 동적 네임스페이스의 이름을 가져옵니다.

    동적 속성에는 정의된 데이터 유형과 sys_id가 있습니다. 동적 속성에 대한 자세한 내용은 동적 스키마를 참조하십시오.

    표 43. 매개변수
    이름 유형 설명
    안 함
    표 44. 반환
    유형 설명
    문자열 동적 네임스페이스의 이름입니다.

    다음 예제는 동적 속성 네임스페이스 이름을 반환하는 방법을 보여줍니다.

    // Gets the name of the namespace from the inc_dynamic_schema dynamic_attribute_store column on the incident table
     
    var gr_Inc = new GlideRecord('incident');
    gr_Inc.query();
    if (gr_Inc.next()) {
        var ge_Make = gr_Inc.getElement('inc_dynamic_schema->make');
        gs.info(ge_Make.getDynamicNamespaceName());
    }

    출력:

    number,short_description,active

    GlideElement - getED()

    필드 내의 데이터가 아닌 특정 필드에 대한 정보를 제공하는 요소 설명자를 반환합니다.

    표 45. 매개변수
    이름 유형 설명
    안 함
    표 46. 반환
    유형 설명
    ElementDescriptor 필드의 요소 설명자입니다.

    이 예에서는 현재 기록에 대한 필드와 필드 설명자를 가져옵니다.

    var fields = current.getFields();
    for (i=0; i<fields.size(); i++) { 
      var field = fields.get(i);
      var descriptor = field.getED(); 
      gs.print("type=" + descriptor.getType() + 
        " internalType=" + descriptor.getInternalType()); 
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getED() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getED()를 사용합니다.

    GlideElement - getElementValue(문자열 값)

    지정된 요소의 값을 반환합니다.

    표 47. 매개변수
    이름 유형 설명
    문자열 반환하려는 값의 요소입니다.
    표 48. 반환
    유형 설명
    문자열 요소의 값입니다.
    var fields = current.getFields();
    for (var i = 0; i < fields.size(); i++) {
      var field = fields.get(i);
      var name = field.getName();
    
      // Returns the unformatted value of the element
      var value = field.getElementValue(name);
      var disValue = field.getDisplayValue();
      gs.print(i + ". " + name + " = " + value + ' display value = ' + disValue);
    }

    출력

    1. cmdb_ci = 109562a3c611227500a7b7ff98cc0dc7 display value = Storage Area Network 001
    2. impact = 2 display value = 2 - Medium

    GlideElement - getError()

    지정된 요소와 연결된 오류 메시지를 반환합니다.

    setError() 메서드를 사용하여 특정 필드(요소)에 오류를 설정합니다.

    표 49. 매개변수
    이름 유형 설명
    안 함
    표 50. 반환
    유형 설명
    문자열 지정된 요소에 대해 현재 설정된 오류 메시지입니다.

    이 예제에서는 short_description 요소에 오류를 설정한 다음 오류를 다시 읽는 방법을 보여줍니다.

    var incidentGR = new GlideRecord('incident');
    incidentGR.setLimit(1);
    incidentGR.query();
    if (incidentGR.next()) {
        incidentGR.short_description.setError('The description is too short.');
        gs.info(incidentGR.short_description.getError()); // 'The description is too short.'
    }

    출력:

    The description is too short.

    이 예제에서는 함수 호출에서 사용하는 getError() 방법을 보여줍니다.

    // Before query business rule (order = 100)
    (function executeRule(current, previous /*null when async*/) {
        var shortDescription = current.getValue('short_description');
        if (shortDescription.length < 10) {
            current.short_description.setError('The description is too short.');
            current.setAbortAction(true);
        }
    })(current, previous);
    
    // Before query business rule (order = 200)
    (function executeRule(current, previous /*null when async*/) {
        var shortDescriptionErrMsg = current.short_description.getError();
        if (shortDescriptionErrMsg) {
            // Some error was set in one of the previous business rules.
        }
    })(current, previous);

    GlideElement - getEscapedValue()

    현재 요소에 대해 이스케이프된 값을 가져옵니다.

    표 51. 매개변수
    이름 유형 설명
    안 함
    표 52. 반환
    유형 설명
    문자열 현재 요소의 이스케이프된 값입니다.

    다음 예제는 getEscapedValue() 메서드를 사용하여 이스케이프 문자가 있는 인시던트 짧은 설명 필드의 내용을 표시하는 방법을 보여줍니다.

    /*** Overview - Update incident short description with escape characters and printing ***/
    var inc = new GlideRecord('incident');
    inc.query();
    inc.next();
    inc.short_description = 'Can\'t log into SAP from my laptop today'; 
    inc.update();
    gs.info("Short Description: "+inc.getElement('short_description').toString()); //without escape characters
    gs.info("Escaped Short Description: "+inc.getElement('short_description').getEscapedValue()); // with escape characters

    출력:

    Short Description: Can't log into SAP from my laptop today
    Escaped Short Description: Can\'t log into SAP from my laptop today

    GlideElement - getFieldStyle()

    필드의 CSS 스타일을 가져옵니다.

    표 53. 매개변수
    이름 유형 설명
    안 함
    표 54. 반환
    유형 설명
    문자열 필드의 CSS 스타일입니다.
    var fields = current.getFields();
    for (var i = 0; i < fields.size(); i++) { 
      var field = fields.get(i);
      var css_style = field.getFieldStyle();  
      gs.print("CSS style" + "=" + css_style); 
    }

    GlideElement - getGlideObject()

    필드 값과 연결된 플랫폼 객체를 검색합니다.

    사용 사례에 대한 자세한 내용은 다음 문서를 참조하십시오 GlideDateTime 필드 값 수정.

    표 55. 매개변수
    이름 유형 설명
    안 함
    표 56. 반환
    유형 설명
    객체 필드의 데이터 유형에 해당하는 플랫폼 객체입니다( 예: GlideDateTime). 값에 대한 형식별 작업에 이 객체를 사용할 수 있습니다. 예를 들어 필드 값을 일반 문자열로 액세스할 때 사용할 수 없는 날짜 산술, 형식 지정 및 시간대 변환이 있습니다.

    다음 예는 인시던트 기록의 개시 날짜와 서비스 수준 계약(SLA) 기한 사이의 기간을 계산하는 방법을 보여줍니다.

    // Query an incident record with both opened_at and sla_due populated
    var incGr = new GlideRecord('incident');
    incGr.addQuery('opened_at', '!=', '');
    incGr.addQuery('sla_due', '!=', '');
    incGr.setLimit(1);
    incGr.query();
    
    if (incGr.next()) {
        gs.info("Incident: " + incGr.getValue('number'));
        gs.info("Opened at: " + incGr.getValue('opened_at'));
        gs.info("SLA due: " + incGr.getValue('sla_due'));
    
        var duration = calcDateDelta(incGr.opened_at, incGr.sla_due);
        if (duration) {
            gs.info("Duration in seconds: " + duration.getNumericValue() / 1000);
            gs.info("Duration display value: " + duration.getDisplayValue());
        }
    }
    
    function calcDateDelta(start, end) {
        var realStart = start.getGlideObject();
        var realEnd = end.getGlideObject();
    
        // Use GlideDuration to calculate the difference between two GlideDateTime objects
        var startMS = realStart.getNumericValue();
        var endMS = realEnd.getNumericValue();
        var deltaMS = endMS - startMS;
    
        // Create a GlideDuration from the millisecond difference
        var duration = new GlideDuration(deltaMS);
        return duration;
    }

    출력:

    Incident: INC0000031
    Opened at: 2025-03-06 00:18:03
    SLA due: 2025-03-06 08:18:03
    Duration in seconds: 28800
    Duration display value: 8 Hours

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getGlideObject() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getGlideObject()를 사용합니다.

    GlideElement - getGlideRecord()

    Glide 기록을 가져옵니다.

    표 57. 매개변수
    이름 유형 설명
    안 함
    표 58. 반환
    유형 설명
    GlideRecord Glide 기록 객체입니다.
    var grInc = new GlideRecord('incident');
    grInc.get('sys_id','ef43c6d40a0a0b5700c77f9bf387afe3');
    gs.info("Initial grInc - " + grInc.getDisplayValue());
    
    var caller = grInc.getElement("caller_id");
    doit(caller);
    
    function doit(caller) {
      var now_GR = caller.getGlideRecord();
      gs.info("doit gr is - " + now_GR.getDisplayValue());
    }

    출력

    *** Script: Initial grInc - INC0000050
    *** Script: doit gr is - INC0000050

    GlideElement - getHTMLValue(Number maxChars)

    필드의 HTML 값을 반환합니다.

    표 59. 매개변수
    이름 유형 설명
    maxChars 번호 옵션입니다. 반환할 최대 문자 수입니다.
    표 60. 반환
    유형 설명
    문자열 필드의 HTML 값입니다.

    다음 예시는 회의 메모의 HTML 컨텐츠를 가져오는 방법을 보여줍니다.

    /*
      getHTMLValueExt() This Function is used to get HTML Value of a field. It accepts 2 Parameters
    
    a. maxChar- Number - The maximum number of characters to return.
    b. nullSub - String - The value to return if the HTML value is null or empty.
    
    */
    
    
    // get a cab meeting record by its sys_id
    var gr = new GlideRecord('cab_meeting');
    gr.addQuery('sys_id','7777777b6d2a20100sys70id534330f6');
    gr.query();
    
    if(gr.next()){
      var substituteString = 'Meeting Notes Unavailable';
      var maxLength = 50;
      gs.print(gr.meeting_notes.getHTMLValueExt(maxLength, substituteString));
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getHTMLValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getHTMLValue()를 사용합니다.

    GlideElement - getHTMLValueExt(Number maxChar, string nullSub)

    필드의 HTML 값을 반환하거나 HTML 값이 null이거나 비어 있는 경우 지정된 대체 값을 반환합니다.

    표 61. 매개변수
    이름 유형 설명
    maxChar 번호 반환할 최대 문자 수입니다.
    null서브 문자열 HTML 값이 null이거나 비어 있는 경우 반환할 값입니다.
    표 62. 반환
    유형 설명
    문자열 HTML 값 또는 지정된 대체 값입니다.

    다음 예시는 회의 메모의 HTML 컨텐츠를 가져오는 방법을 보여줍니다.

    // get a cab meeting record by its sys_id
    var gr = new GlideRecord('cab_meeting');
    gr.addQuery('sys_id','7777777b6d2a20100sys70id534330f6');
    gr.query();
    
    if(gr.next()){
      var substituteString = 'Meeting Notes Unavailable';
      var maxLength = 50;
      gs.print(gr.meeting_notes.getHTMLValueExt(maxLength, substituteString));
    }
    선택한 기록의 회의 메모가 비어 있지 않은 경우의 출력:
    <p>Meeting note content.</p>

    GlideElement - getJournalEntry(Number mostRecent)

    가장 최근의 저널 항목 또는 모든 저널 항목을 반환합니다.

    표 63. 매개변수
    이름 유형 설명
    가장 최근 번호 1이면 가장 최근 항목을 반환합니다. -1이면 모든 저널 항목을 반환합니다.
    표 64. 반환
    유형 설명
    문자열

    가장 최근 항목의 경우 저널 항목의 필드 레이블, 타임스탬프 및 사용자 표시 이름을 포함하는 문자열을 반환합니다.

    모든 저널 항목에 대해 "\n\n"으로 구분된 단일 문자열로 입력된 모든 저널 항목에 대해 동일한 정보를 반환합니다.

    //gets all journal entries as a string where each entry is delimited by '\n\n'
    var notes = current.work_notes.getJournalEntry(-1); 
    //stores each entry into an array of strings
    var na = notes.split("\n\n");  
                          
    for (var i = 0; i < na.length; i++)                 
      gs.print(na[i]);

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getJournalEntry() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getJournalEntry()를 사용합니다.

    GlideElement - getLabel()

    객체의 레이블을 반환합니다.

    표 65. 매개변수
    이름 유형 설명
    안 함
    표 66. 반환
    유형 설명
    문자열 객체의 레이블
    var now_GR = new GlideRecord("sc_req_item");
    now_GR.addQuery("request", current.sysapproval);
    now_GR.query();
    while(now_GR.next()) {
        var nicePrice = now_GR.price.toString();
        if (nicePrice != ) {
            nicePrice = parseFloat(nicePrice);
            nicePrice = nicePrice.toFixed(2);
        }
        template.print(now_GR.number + ":  " + now_GR.quantity + " X " + now_GR.cat_item.getDisplayValue() + " at $" + nicePrice + " each \n");
        template.print("    Options:\n");
        var variables = now_GR.variables.getElements();    
        for (var key in variables) {
          var now_V = variables[key];
          if(now_V.getQuestion().getLabel() != ) {
             template.space(4);
             template.print('     ' +  now_V.getQuestion().getLabel() + " = " + now_V.getDisplayValue() + "\n");  
          }
        }
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getLabel() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getLabel()을 사용합니다.

    GlideElement - getLabelLang(문자열 언어)

    매개변수로 전달된 언어로 된 필드의 레이블 값을 가져옵니다.

    번역된 값을 검색하려면 해당 언어 플러그인이 있어야 합니다. 자세한 내용은 Activate a language 문서를 참조하십시오.

    표 67. 매개변수
    이름 유형 설명
    언어 문자열 IETF BCP-47을 준수하는 언어 태그입니다.
    표 68. 반환
    유형 설명
    문자열 전달된 언어의 필드 레이블 값입니다. 번역을 사용할 수 없는 경우 메서드는 현재 사용자의 언어로 번역된 값을 검색합니다. 번역을 사용할 수 없는 경우 결과는 기본적으로 영어로 설정됩니다.

    다음 예는 원본 레이블 텍스트와 수락 (UI 뷰) 제목의 독일어 번역본을 가져오는 방법을 보여줍니다.

    var uiView = new GlideRecord("sys_ui_view");
    uiView.get("fa776f6d97700100f309124eda2975bc");
    
    gs.info("getLabel: " + uiView.getElement("title").getLabel());
    gs.info("getLabelLang: " + uiView.getElement("title").getLabelLang("de"));

    출력:

    getLabel: Title
    getLabelLang: Titel

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getLabelLang() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getLabelLang()을 사용합니다.

    GlideElement - getName()

    필드의 이름을 반환합니다.

    표 69. 매개변수
    이름 유형 설명
    안 함
    표 70. 반환
    유형 설명
    문자열 필드 이름입니다.

    다음 예는 sys_user 기록의 각 필드에 대한 이름과 기타 값을 가져오는 방법을 보여줍니다.

    var userRec = new GlideRecord("sys_user"); // GlideRecord to sys_user table
    
    userRec.get("5137153cc611227c000bbd1bd8cd2005"); // Sys Id of user: Fred Luddy
    
    var fields = userRec.getFields();
    
    for (var i = 0; i < fields.size(); i++) {
    
        var field = fields.get(i);
        var name = field.getName(); // Name of the field
        var label = field.getLabel(); // Label of the field
        var value = field.getDisplayValue(); // Value of the field
    
        gs.info((Number(i) + 1) + ".\n" + "Field Label: " + label + "\n" + "Field Name: " + name + "\n" + "Field Value: " + value);
    
    };

    출력. 결과에는 62개의 필드가 포함되며 공간을 절약하기 위해 줄임표(...)로 잘렸습니다.

    *** Script: 1.
    Field Label: Country code
    Field Name: country
    Field Value: 
    *** Script: 2.
    Field Label: Calendar integration
    Field Name: calendar_integration
    Field Value: Outlook
    ...
    *** Script: 47.
    Field Label: First name
    Field Name: first_name
    Field Value: Fred
    ...
    *** Script: 54.
    Field Label: Last name
    Field Name: last_name
    Field Value: Luddy
    ...

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getName() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getName()를 사용합니다.

    GlideElement - getRefRecord()

    지정된 참조 요소에 대한 GlideRecord 객체를 반환합니다.

    계산된 필드의 경우 이 메서드는 참조된 기록을 가져오고 스크립팅된 기본값에 대한 계산을 실행합니다.

    경고:
    참조 요소에 값이 포함되어 있지 않으면 NULL 객체가 아닌 빈 GlideRecord 객체를 반환합니다.
    표 71. 매개변수
    이름 유형 설명
    안 함
    표 72. 반환
    유형 설명
    GlideRecord GlideRecord 객체
    
    var grINC = new GlideRecord('incident'); 
    grINC.notNullQuery('caller_id'); 
    grINC.query(); 
    if (grINC.next()) { 
    
    // Get a GlideRecord object for the referenced sys_user record 
    var grUSER = grINC.caller_id.getRefRecord(); 
    if (grUSER.isValidRecord()) 
      gs.print( grUSER.getValue('name') ); 
    
    } 

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getRefRecord() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getRefRecord()를 사용합니다.

    GlideElement - getStyle()

    값의 CSS 스타일을 가져옵니다.

    표 73. 매개변수
    이름 유형 설명
    안 함
    표 74. 반환
    유형 설명
    문자열 값의 CSS 스타일입니다.
    // Get string of style field from Field Style record
    var cssStyle = now_GR.state.getStyle();

    GlideElement - getTableName()

    필드가 들어 있는 테이블의 이름을 반환합니다.

    표 75. 매개변수
    이름 유형 설명
    안 함
    표 76. 반환
    유형 설명
    문자열 호출되는 필드가 들어 있는 테이블의 이름입니다. 반환된 값은 기록이 있는 테이블 클래스와 다를 수 있습니다. 자세한 내용은 Table extension and classes 문서를 참조하십시오.
    if (current.approver.getTableName() == "sysapproval_approver") {
        if (current.approver == email.from_sys_id) {
            current.comments = "reply from: " + email.from + "\n\n" + email.body_text;
    
            // if it's been cancelled, it's cancelled.
            var doit = true;
            if (current.state == 'cancelled')
                doit = false;
    
            if (email.body.state != undefined)
                current.state = email.body.state;
    
            if (doit)
                current.update();
        } else {
            gs.log("Approval for task " + current.sysapproval.getDisplayValue() +
                " rejected because user sending email " + email.from +
                " does not match the approver " + current.approver.getDisplayValue());
        }
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getTableName() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 getTableName()을 사용합니다.

    GlideElement - getTextAreaDisplayValue()

    연결된 필드의 표시 값을 검색하고 HTML을 이스케이프합니다.

    표 77. 매개변수
    이름 유형 설명
    안 함
    표 78. 반환
    유형 설명
    문자열 연결된 필드에 대한 이스케이프된 표시 값 HTML입니다.

    다음 예시에서는 KB 문서의 표시 값을 검색합니다.

    var grh = new GlideRecord('kb_knowledge');
    grh.get('c85cd2519f77230088aebde8132e70c2');  // Knowledge record sys_id
    var t = grh.text.getTextAreaDisplayValue(); // Text is HTML type field
    var d = GlideXMLUtil.parseHTML(t); // Parse the HTML
    var b = d.getDocumentElement().getTextContent().trim();
    gs.info(b);

    출력:

    This article explains how to use automatic replies in Outlook 2010 for Exchange accounts.
    
    Setting Up Automatic Replies
    
    Click the 
    File tab.
    Click 
    Automatic Replies.
    Select 
    Send automatic replies.
    If desired, select the 
    Only send during this time range check box to schedule when your out of office replies are active. If you do not specify a start and end time, auto-replies will be sent until you select the
     Do not send automatic replies check box.
    On the 
    Inside My Organization tab, type the response that you want to send to colleagues while you are out of the office.
    On the 
    Outside My Organization tab, select the 
    Auto-reply to people outside my organization check box, and then type the response that you want to send while you are out of the office. Select whether you want replies sent to 
    My contacts only or to 
    Anyone outside my organization who sends you messages.
    
    NOTE:
    If you select 
    My Contacts only in step 6, replies will be sent 
    only to contacts that exist in your Contacts folder.
    
    
    
    Using Rules With Automatic Replies
    It is also possible to use rules to manage your messages while you are out of office. For example, you can create rules to automatically move or copy messages to other folders, to delete messages, to send custom replies, and so on.
    
    Click the 
    File tab.
    Click 
    Automatic Replies.
    Click 
    Rules, and then click 
    Add Rule.
    Under 
    When a message arrives that meets the following conditions, specify the conditions that the message must meet for the rule to be applied. If you want to specify more conditions, click 
    Advanced, enter or select the options that you want, and then click 
    OK.
    If you want to specify that this rule must be applied last, select the 
    Do not process subsequent rules check box.
    Under 
    Perform these actions, select the actions that you want. You can select more than one action.
    Click 
    OK three times.
    
    NOTES:
    
    Automatic Replies rules can also be edited by following the above procedure.
    To turn Automatic Replies rules on or off, in the Automatic Reply Rules dialog box, select or clear the check box of the rule that you want to turn on or off.
    

    GlideElement - getValue()

    데이터베이스의 필드 값을 반환합니다.

    표 79. 매개변수
    이름 유형 설명
    안 함
    표 80. 반환
    유형 설명
    문자열 필드의 값입니다.

    다음 예제에서는 데이터베이스에서 지정된 필드의 값을 검색합니다.

    var now_GR = new GlideRecord('incident');
    now_GR.get('9c573169c611228700193229fff72400'); //INC0000001
    gs.info('Display Values');
    gs.info('Opened at ' + now_GR.opened_at.getDisplayValue());
    gs.info('Opened by ' + now_GR.opened_by.getDisplayValue());
    gs.info('Priority ' + now_GR.priority.getDisplayValue());
    gs.info('Values');
    gs.info('Opened at ' + now_GR.opened_at.getValue());
    gs.info('Opened by ' + now_GR.opened_by.getValue());
    gs.info('Priority ' + now_GR.priority.getValue());
    

    출력:

    Display Values
    Opened at 2022-02-01 15:09:51
    Opened by Joe Employee
    Priority 1 - Critical
    Values
    Opened at 2022-02-01 23:09:51
    Opened by 681ccaf9c0a8016400b98a06818d57c7
    Priority 1
    

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 getValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드를 GlideElement - 범위 지정됨사용합니다.

    GlideElement - getXHTMLValue()

    필드의 XHTML 값을 검색합니다.

    표 81. 매개변수
    이름 유형 설명
    안 함
    표 82. 반환
    유형 설명
    문자열 XHTML 값

    GlideElement - getXMLValue()

    필드의 XML 값을 문자열로 가져옵니다.

    표 83. 매개변수
    이름 유형 설명
    안 함
    표 84. 반환
    유형 설명
    문자열 XML 값

    GlideElement - hasAttribute(String attributeName)

    필드에 지정된 속성이 있는지 여부를 결정합니다.

    표 85. 매개변수
    이름 유형 설명
    attributeName 문자열 속성의 이름입니다. 속성 이름은 딕셔너리 항목 [sys_dictionary] 테이블에 나열됩니다.
    표 86. 반환
    유형 설명
    부울 필드에 지정된 속성이 있는지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: 필드에 지정된 속성이 있습니다.
    • false: 필드에 지정된 속성이 없습니다.

    다음 예는 속성이 있는 사용자 [sys_user] 테이블에서 필드를 edge_encryption_enabled 가져오는 방법을 보여줍니다.

    var fields = new GlideRecord('sys_user');
    
    fields.query();
    
    var userFields = fields.getFields();
    
    for (var num = 0; num < userFields.size(); num++) {
        var ed = userFields.get(num).getED();
    
        if (ed.hasAttribute("edge_encryption_enabled")) {
            gs.info(userFields.get(num).getName());
        }
    }

    출력:

    *** Script: hashed_user_id
    *** Script: federated_id

    GlideElement - hasRightsTo(문자열 operationName)

    사용자에게 특정 작업을 수행할 권한이 있는지 여부를 결정합니다.

    표 87. 매개변수
    이름 유형 설명
    operationName 문자열 확인할 운영의 이름
    표 88. 반환
    유형 설명
    부울 사용자에게 작업을 수행할 권한이 있으면 True, 그렇지 않으면 False입니다.

    사용자에게 작업을 수행할 권한이 있는지 여부를 나타내는 플래그입니다.

    유효한 값은 다음과 같습니다.
    • true: 사용자에게 권한이 있습니다.
    • false: 사용자에게 권한이 없습니다.

    다음 예시는 사용자에게 특정 테이블을 읽을 수 있는 권한이 있는지 확인하는 방법을 보여줍니다.

    // Pass table name and userId to check if user has read access against given table name
    checkAccess('incident', 'adela.cervantsz');
    
    function checkAccess(tableName, userID) {
    
        var inc = new GlideRecordSecure(tableName);
        inc.get('$[sys_id]');
    
        var secureManager = GlideSecurityManager.get();
    
        //fetch a different user, using user_name field on the target user record
        var userObj = gs.getUser().getUserByID(userID); 
        secureManager.setUser(userObj);
    
        var access = 'record/incident/read';
    
        //check if user has right to access
        var canRead = secureManager.hasRightsTo(access, inc); 
        gs.info('canRead: ' + canRead);
    }

    출력:

    canRead: false

    GlideElement - hasValue()

    필드에 값이 있는지 여부를 결정합니다.

    표 89. 매개변수
    이름 유형 설명
    안 함
    표 90. 반환
    유형 설명
    부울 필드에 값이 있으면 예이고 그렇지 않으면 아니오입니다.

    GlideElement - nil()

    필드가 null인지 여부를 결정합니다.

    표 91. 매개변수
    이름 유형 설명
    안 함
    표 92. 반환
    유형 설명
    부울 필드가 null이거나 빈 문자열이면 True이고 그렇지 않으면 False입니다.
    if (current.start_date.changes() || current.end_date.changes() || current.assigned_to.changes()) { 
      if (!current.start_date.nil() && !current.end_date.nil() && !current.assigned_to.nil()) {
     gs.eventQueue("change.calendar.notify", current, current.assigned_to, previous.assigned_to);
     
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 nil() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 nil()을 사용합니다.

    GlideElement - setDateNumericValue(숫자 밀리초)

    기간 필드에 대해 기간 필드를 1970년 1월 1일 00:00:00 GMT 이후의 밀리초 수로 설정합니다. 기간 필드가 이미 GlideDateTime 객체이므로 GlideDateTime 객체를 생성할 필요가 없습니다.

    표 93. 매개변수
    이름 유형 설명
    밀리초 번호 기간에 걸친 밀리초 수입니다.
    표 94. 반환
    유형 설명
    무효
    var inc = new GlideRecord('incident');
    inc.get('17c90efb13418700cc36b1422244b05d');
    var timems = inc.calendar_duration.dateNumericValue();
    timems = timems + 11*1000; 
    inc.calendar_duration.setDateNumericValue(timems)
    gs.info(inc.calendar_duration.getValue());

    출력:

    1970-01-01 00:01:38

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 setDateNumericValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 setDateNumericValue()를 사용합니다.

    GlideElement - setDisplayValue(Object displayValue)

    필드의 표시 값을 설정합니다.

    표 95. 매개변수
    이름 유형 설명
    displayValue 객체 표시할 값입니다.
    표 96. 반환
    유형 설명
    무효

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 setDisplayValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 setDisplayValue()를 사용합니다.

    GlideElement - setError(문자열 errorMessage)

    연결된 필드에 오류 메시지를 추가합니다.

    getError() 메서드를 사용하여 오류 메시지를 검색할 수 있습니다.

    표 97. 매개변수
    이름 유형 설명
    errorMessage 문자열 오류 메시지입니다.
    표 98. 반환
    유형 설명
    없음
    if ((!current.u_date1.nil()) && (!current.u_date2.nil())) {
      var start = current.u_date1.getGlideObject().getNumericValue();
      var end = current.u_date2.getGlideObject().getNumericValue();
      if (start > end) {
        gs.addInfoMessage('start must be before end');
        current.setAbortAction(true);
        current.u_date1.setError('start must be before end');
      }
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 setError() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 setError()를 사용합니다.

    GlideElement - setInitialValue(객체 값)

    필드의 초기값을 설정합니다.

    이 방법은 더 이상 사용되지 않습니다. 이 기능에 사용합니다 GlideElement - setValue(객체 값) .

    표 99. 매개변수
    이름 유형 설명
    객체 필드의 초기 값입니다.
    표 100. 반환
    유형 설명
    무효

    GlideElement - setJournalEntry(String entry, String userName)

    저널 항목과 작성자를 작업 메모 또는 설명 필드로 추가합니다.

    표 101. 매개변수
    이름 유형 설명
    항목 문자열 저널 항목의 내용입니다.
    userName 문자열 옵션입니다. 저널 항목의 속성을 지정할 사용자입니다.
    표 102. 반환
    유형 설명
    없음

    다음 예는 작업 메모와 해당 작성자를 기록에 추가하는 방법을 보여줍니다.

    var now_GR = new GlideRecord("incident");
    
    now_GR.addQuery("sys_id", "<sys_id_value>");
    now_GR.query();
    
    if(now_GR.next()){
      now_GR.work_notes.setJournalEntry("Content of the journal entry.", "abel.tuter");  
      now_GR.update();
    }

    GlideElement - setValue(객체 값)

    필드의 값을 설정합니다.

    주:
    이 메서드를 호출하기 전에 기존 레코드를 쿼리하거나 now_GR.initialize() 메서드를 사용하여 새 레코드를 초기화하여 요소가 이미 존재해야 합니다.
    password2 필드를 사용한 인증 아님
    setValue() 메서드는 password2 데이터를 일반 텍스트로 전달하므로 암호화된 데이터를 예상하는 것에 대한 오류가 발생합니다. 또한 password2 필드에 setValue() 메서드를 사용하면 암호화해야 하는 데이터가 노출됩니다.

    password2 인증의 경우 setDisplayValue() 메서드를 대신 사용합니다.

    표 103. 매개변수
    이름 유형 설명
    객체 설정할 필드 값입니다.
    표 104. 반환
    유형 설명
    없음

    문자열을 전달하는 값을 설정합니다.

    var glideRecord = new GlideRecord('incident');
    glideRecord.query('priority','1');
    glideRecord.next();
    glideRecord.short_description.setValue('Network failure');

    객체를 전달하는 값을 설정합니다.

    var now_GR  = new GlideRecord('student');
    now_GR.initialize();
    now_GR.setValue('first_name', 'Joe');
    now_GR.setValue('last_name', 'Smith');
    now_GR.insert();

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 setValue() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 setValue()를 사용합니다.

    GlideElement - toString()

    필드의 값을 문자열로 변환합니다.

    표 105. 매개변수
    이름 유형 설명
    안 함
    표 106. 반환
    유형 설명
    문자열 문자열로 표시되는 필드의 값입니다.
    doit();
     
    function doit() { 
     
      var now_GR = new GlideRecord('sys_user');
      now_GR.query();
      while (now_GR.next()) {
      if ((now_GR().length != now_GR.first_name.toString().trim().length) || (now_GR.last_name.toString().length 
             != now_GR.last_name.toString().trim().length)) {
          now_GR.first_name = now_GR.first_name.toString().trim();
          now_GR.last_name = now_GR.last_name.toString().trim();
          now_GR.autoSysFields(false);
          now_GR.update();
        }
      }
     
    }

    범위가 지정된 해당 항목

    범위가 지정된 애플리케이션에서 toString() 메서드를 사용하려면 해당하는 범위가 지정된 메서드인 toString()을 사용합니다.