Advertisement
Savelyev_Vyacheslav

fieldsOfView

Apr 24th, 2024
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const fields = fieldsOfView('itsm_change_request', '171389475835325430')
  3.  
  4. print_r(fields)
  5.  
  6. function fieldsOfView(tableName, formId) {
  7.     let tableID = (new SimpleRecord('sys_db_table')).get('name', tableName).sys_id;
  8.     let field = new SimpleRecord('sys_ui_form_element')
  9.     field.addQuery('form_section_id.form_id.table_id', tableID)
  10.     field.addQuery('form_section_id.form_id', formId)
  11.     field.addQuery('column_id', 'ISNOTEMPTY')
  12.     field.orderBy('position');
  13.     field.query();
  14.     let fieldLocation = {};
  15.     let section = [];
  16.     let fieldName = [];
  17.     let sectionAndFieldNemes = [];
  18.     while (field.next()) {
  19.         fieldLocation[field.column_id.column_name] = getDisplayName(field.column_id)
  20.     }
  21.     return fieldLocation
  22. }
  23.  
  24. function getDisplayName(ID) {
  25.       let field = new SimpleRecord('sys_translation')
  26.       field.addQuery('record_id', ID)
  27.       field.addQuery('language_id', ss.getUser().language_id)
  28.       field.query();
  29.       field.next()
  30.       return field.value
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement