The CreatorCon Call for Content is officially open! Get started here.

Getting error "cannot find function split in object" while updating record. Below is my fix script

Harshal Sonawa1
Kilo Guru
updateAcceptanceDate();

function updateAcceptanceDate() {

    var gr = new GlideRecord('clinical_devices');
    gr.addEncodedQuery('customer=c8c1bcdedb60630062d6f9c41d9619bb^install_status=1^u_acceptance_dateISEMPTY');
    gr.setLimit(1);
    gr.query();

    gs.info('device count : ' + gr.getRowCount());

    while (gr.next()) {

        gs.info(' name of asset: ' + gr.name);
		var assetName = gr.name;
        var installDate = gr.install_date;

        var gdt = new GlideDateTime(installDate);
        var onlyDateValue = gdt.getDate();

        gs.info(' installDate : ' + installDate);
        gs.info(' onlyDateValue : ' + onlyDateValue);

        // gr.u_acceptance_date = onlyDateValue;
      
        gr.setValue('u_acceptance_date', onlyDateValue);
        gr.update();




    }


}
1 ACCEPTED SOLUTION

Harshal Sonawa1
Kilo Guru

Problem solved by adding one line before gr.query();

  gr.setWorkflow(false); 

View solution in original post

2 REPLIES 2

Harshal Sonawa1
Kilo Guru

Record is getting updated but I get error while running fix script.

Harshal Sonawa1
Kilo Guru

Problem solved by adding one line before gr.query();

  gr.setWorkflow(false);