Copy record value (multiple items)

user_ms
Tera Expert

(1)

Copy item B of table A to item E
Copy item C from table A to item F

 

tableA  tableD
ItemB → ItemE
ItemC → ItemF

 

It is implemented using "script include" or "client script", and it is possible to copy only one item.
If you know how to make multiple copies, please let me know.

 

//script include
var test_getData = Class.create();
test_getData.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

    Test: function() {
        var test = this.getParameter('sysparm_test');
		var gr = new GlideRecord('test_table');
		gr.addQuery("sys_id", test);
		gr.query();
        while (gr.next()) {
            return gr.test;
		}
        return '';
    },
	
    type: 'test_getData'
});

//client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
	var ga = new GlideAjax('test_test_getData'); 
        ga.addParam('sysparm_name', 'Test');
	ga.addParam('sysparm_test, newValue);

    ga.getXMLAnswer(function(answer) {
        if (answer != "" || answer != null) {
            g_form.setValue('test', answer);
        }
    });
}

 

(2)

Could you also tell me how to set the 8-digit number input in the string type to the date field?

What kind of conversion do you need?

ItemG(string) → ItemH(date)

20240116  → 2024-01-16

0 REPLIES 0