Adding a variable summary to RITM/SCTASK work notes

Subhajit Mukhe1
Kilo Expert

When we are ordering a catalog item, i need a summary of all the variables to be posted as work notes.

find_real_file.png

We have something called approval summarizer which gives a summary of variables in the approval record. I want a similar implementation in RITM worknotes or replace the variable editor with this.

Any help will be appreciated.

6 REPLIES 6

How to do this as a UI action that will add the values from the variables to the Work Notes on demand? For example, a button in the RITM or SCTASK like "Summarize this"

shrikantkhodke
Tera Contributor

Hey @Subhajit Mukhe1,

I have created one easy solution for you requirement. Follow the steps as below

1. create 'before insert' business rule on sc_req_item table and add the following script in it.

(function executeRule(current, previous /*null when async*/ ) {
    var desc = "";
    desc = 'Summary of Request: \n\n';
    var set = new GlideappVariablePoolQuestionSet();
    set.setRequestID(current.sys_id);
    set.load();
    var vs = set.getFlatQuestions();
    for (var i = 0; i < vs.size(); i++) {
        if ((vs.get(i).getLabel() != '') && (vs.get(i).getDisplayValue() != '') && (vs.get(i).getDisplayValue() != 'false')) {
            desc += vs.get(i).getLabel() + ":  " + vs.get(i).getDisplayValue() + "\n";
        }
    }
    current.comments = desc+"\n testing";  // you should add work_notes here instead of comments 
})(current, previous);
 
Do not forget to add the condition to the BR for which Catalog Item u want summary of request.

Note: It is the server side script u can use it anywhere such as flow, BR, Script Include as per your requirement.
shrikantkhodke_0-1739989077607.pngshrikantkhodke_1-1739989114996.png

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!