- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-28-2024 09:56 AM
Hi all,
I am importing service account to cloud service account table .'Account id ' Field is coalesce field.When I am running import I want to update the 'Updated on' field with current run time for each service account for which account ID matches even if record is skipped or ignored (When no field value change) and operation status should be operational.
The records which are not updated with latest run .I want to update operational status as 'non-operational' for those service accounts.
Could you please help me how can i get this .
Thanks & regards,
Abhishek
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-04-2024 10:22 AM
It may be running, but not updating. You should try the option provided by @Sumanth16 which is a better way of doing it by using onComplete transform script.
Also when you use onComplete, you may need to change query to not update in last 4 or 6 hours. Also add gs.info to know if it is able to find any account.
var gr = new GlideRecord('cmdb_ci_cloud_service_account');
gr.addEncodedQuery("sys_updated_onNOTONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()");
gr.query();
while (gr.next()) {
gr.info('++Service Account Non Operational++++'+gr.name);
gr.operational_status=2;
gr.update();
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-28-2024 02:00 PM
You can map the updated on field with the import table sys_created_on/Created field.
Then you can run a scheduled job, which dont have updated on as today, to set to non-operation.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-04-2024 09:48 AM
Thanks for your response Sanjiv.
I have created one scheduled job to run Data source and another one to update service accounts to non operation .For second one I have selected as 'After Parent runs' and i have selected post import script as below .But second scheduled job is not executing .Am I missing something here.Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-04-2024 09:58 AM
Hi @_bhishek ,
Instead of a scheduled job use configure the same script in oncomplete transform script.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-04-2024 10:22 AM
It may be running, but not updating. You should try the option provided by @Sumanth16 which is a better way of doing it by using onComplete transform script.
Also when you use onComplete, you may need to change query to not update in last 4 or 6 hours. Also add gs.info to know if it is able to find any account.
var gr = new GlideRecord('cmdb_ci_cloud_service_account');
gr.addEncodedQuery("sys_updated_onNOTONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()");
gr.query();
while (gr.next()) {
gr.info('++Service Account Non Operational++++'+gr.name);
gr.operational_status=2;
gr.update();
}
Please mark this response as correct or helpful if it assisted you with your question.