Hi Domagoj.
Yes , technically this is possible.
The question is, if it really fits to your business requirements.
To me, just specifying a CI in an incident, doesn't mean that the CI has a problem !
Same for Changes. Sure it might make sense to set a CI to status "maintenance" when the change gets implemented, but this is more related to the change implementation start and end date, than to the fact that the CI is attached to the Change. Additionally you need to think about a mechanism which resets the status of your CI's again
As I understand, this is a complex discussion, and I have my doubts that the different scenarios can be handled with a simple macro.
nevertheless here is a very simple macro which sets the status of the affected resource of an incident to "in Repair".
TABLE Spell_Macro
del description fragment id last_mod_by last_mod_dt lock_object msg_html
msg_tmpl_info ob_type persid sym tenant type usr_integer1 usr_integer2
usr_integer3 usr_string2 usr_string3 usr_string4
{ "0" ,"",
"object nr_obj;\\0012if(!is_null(affected_resource)) {\\0012 send_wait(0, this,\"call_attr\",\"affected_resource\",\"get_dob\");\\0012 nr_obj= msg[0];\\0012\\0012 send_wait(0,group_leader,\"sure_checkout\",nr_obj,10,5);\\0012 if(!msg_error()) {\\0012 send_wait(0,nr_obj,\"call_attr\",\"status\", \"set_val\",2601); // 2601 is rss id of \"in Repair\" status\\0012 if(!msg_error()) {\\0012 logf(SIGNIFICANT,\"Status of affected resource set.\");\\0012 }\\0012 else {\\0012 logf(ERROR,\"error in setting Status of affected resource:%s\",msg[0]);\\0012 }\\0012\\0012 }\\0012 else {\\0012 logf(ERROR,\"Unable to change status of affected resource\");\\0012 }\\0012}\\0012else {\\0012 logf(SIGNIFICANT,\"No affected resource\");\\0012}\\0012\\0012",
"400311" ,"F66961EF717A01F7A294000C2990289B" ,"03/19/2019 18:58:38" ,"1" ,"",
"" ,"cr" ,"macro:400311" ,"set affected_resource status to \"in Repair\"",
"" ,"ACT" ,"" ,"" ,"" ,"" ,"" ,"" }
Its a pdm_load syntax, I suggest loading it with pdm_load -i -f to create a new id for this record and not harm existing ones.
It can be used as an action in an incident event. The macro would look a bit different, when you want to execute it in a task behavior context.
As said, very simple and not matching to each and any situation, but maybe helpful as starting point.
Use this on your own risk in your test/development environment.
Best regards
............Michael