Copy multi-row variable set to another task

Shawn Dowler
Tera Guru

In London and Madrid I can create multi-row variable sets and get them to display in the formatter for the submitted record using a record producer. I want to be able to copy the variable set to another task. I can do this using the question_answer table, but the variables don't get formatted like a multi-row variable set. I tried also creating records in the sc_multi_row_question_answer table and it doesn't seem to make a different. The Row index field can't be the only thing, because I tried creating a record using a record producer that rendered the multi-row variable set correctly, duplicating the records and deleting the old ones and it still would render my new variables as a table.

Any missing pieces in this equation? I couldn't find any other tables that might be involved or fields on the question_answer table or sc_multi_row_question_answer table.

Thanks!

1 ACCEPTED SOLUTION

H_kon Sm_rvik
Kilo Expert

I might have found the missing piece!

You need to create a record in the table sc_item_produced_record. The formatting seems to be correct as well.

In my code I added this snipppet. This piece is targeted at a single catalog item, and towards the change_request table. It should be easy enough to modify this to accomodate other producers and tables.

function createProducedRecord(change_id) {
  var producer = new GlideRecord("sc_cat_item");
  producer.addQuery("name", "<name of record producer / cat_item>");
  producer.query();
  
  if (producer.next()) {
    var produced_record = new GlideRecord("sc_item_produced_record");
    produced_record.initialize();
    produced_record.record_table = "change_request";
    produced_record.task = change_id;
    produced_record.record_key = change_id;
    produced_record.producer = producer.getUniqueValue();
    produced_record.insert();
  }
}

View solution in original post

5 REPLIES 5

This works !