Is there a way to record changes to catalog variables after submission

johnfeist
Mega Sage
Mega Sage

I have occasions where reviewers or fulfillers may need to change a value added by  the requestor.  Other than having to write a lot of AJAX On Change Catalog Client Scripts, is there anyway to note those changes into the activities for the given item (sc_req_item)?

TIA for any insights you can offer.

:{)

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster
1 ACCEPTED SOLUTION

Actually, it's sc_item_option where the BR lives:

if (previous.value != current.value) {
        var var_owner = new GlideRecord('sc_item_option_mtom');
        var_owner.addQuery('sc_item_option', current.sys_id);
        var_owner.query();
        if (var_owner.next()) {
            var itm = new GlideRecord('sc_req_item');
            itm.addQuery('sys_id', var_owner.request_item);
            itm.query();
            if (itm.next()) {
                itm.comments = 'Variable updated ' + current.item_option_new.getDisplayValue() + ' value changed from ' + previous.value.getDisplayValue() + ' to ' + current.value.getDisplayValue() + ' By ' + gs.getUserName();
                itm.update();
            }
        }
    }

This is an after update rule.

:{)

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

View solution in original post

6 REPLIES 6

Aman Kumar S
Kilo Patron

You can configure activity context to record field changes using Filter activities.

You will find that below work notes, on the right of Activities tab

Best Regards
Aman Kumar

Thank you Aman.  Unfortunately, the the activity context only covers form fields.  Variables are not included in the options there.

:{(

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Aman Kumar S
Kilo Patron

Did you try BR?
Whenever there are changes in variables fields, you can just update the work notes/comments

Best Regards
Aman Kumar

Unfortunately it's not that simple. Variables are not considered fields like state or assignment group.  Capturing and recording those changes is a lot more complicated.

:{)

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster