
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 10:19 AM
Dear all,
we are creating a Windows Server CI through the script in the workflow. The field Managed by group stays empty. Audit shows no changes in the field happening. Same variable returns the value nicely in another field (comments). The workflow has a pause tiemer in the beginning, so it runs as a System. Interestingly also, 1 time out of 7-10 the field will be filled. Any ideas?
//Create a Win Server
var win = new GlideRecord('cmdb_ci_win_server');
win.initialize();
win.support_group = 'fixed_sys_id'; //this works
win.managed_by_group = current.variables.managed_by_group; //the field stays empty
win.comments = "Managed by application group " + current.variables.managed_by_group.name; //this works
var winServId = win.insert();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 06:12 AM
We found the problem. Business rule "CSDM Data Sync on Reclassification" is wrongly clearing CI "managed_by_group" field, thinking that the class has been chancghed, even if the CI is created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 10:31 AM
Hi @Vladimir6
The managed_by_group field is likely a reference field that requires a valid sys_id. If current.variables.managed_by_group is not a valid sys_id or is in the wrong format, the field won't be set correctly.
Replace this in your code:
win.managed_by_group = current.variables.managed_by_group.sys_id; // Ensure this is a sys_id
……………………………………………………………………………………………………
Please Mark it helpful 👍and Accept Solution✔️!! If this helps you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 10:35 AM
Thank you Satishkumar B, I tried as below, allthough without success:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 10:32 AM
To clarify, a pause timer at the beginning of a workflow, does not necessarily ensure that the entire workflow will run as System. If there is an approval, Catalog Task, or other user interaction prior to this Run Script, add another timer just before this Run Script activity to ensure that it is running as System. You can always log the current user in the Run Script so that you know for sure. In your test cases, are you using the same value to populate the managed_by_group variable? Are there any other differences in the test cases - user executing it, values supplied,...?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 10:45 AM
Hello Brad,
one of 10 success can be just a manual intervention of another user. I mentioned them because I run out of options like BR Debugging and try/catch.
I start the WF through the ATF with same values. There are also real runs with different Managed by group -variable, also without success. CIs are "sys_created_by" system, but also ITIL users are able to create or update them, so it is not important.