Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 03:02 AM
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();
}
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 05:18 AM
Problem solved by adding one line before gr.query();
gr.setWorkflow(false);
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 03:03 AM
Record is getting updated but I get error while running fix script.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 05:18 AM
Problem solved by adding one line before gr.query();
gr.setWorkflow(false);