How to change Workflow Table

Lisa Silvaroli
Tera Guru

Is there a way to change the Table of a Workflow after its already been created/published? It appears to be read only.

workflow.JPG

1 ACCEPTED SOLUTION

Uncle Rob
Kilo Patron

So... was looking at this just today.  Checked out the Workflow, Table field clearly looks read only...

 

find_real_file.png

But being the stubborn old curmudgeon that I am... I clicked the field anyway.  To my shock and awe, a full 20 seconds later, the list of tables popped up.

find_real_file.png

 

SO... there's that.

View solution in original post

17 REPLIES 17

nayanawadhiya1
Kilo Sage

Hey Lisa,



CHECKOUT that workflow and do the changes then PUBLISH IT again.


I have it checked out but its still a read only field.


I have the same question. The Requested Item workflow I copied can't be changed to another table. The only table in the choice list is sc_req_item.


You can't change it on the form if the Workflow is already set to a couple special tables like Requested Item or SLA, but you can change it behind the scenes.   Use the "Workflow Versions" Module to filter down the list and display the new Workflow you've copied:


find_real_file.png


find_real_file.png



You can use one of these tools to help you generate the proper GlideRecord script to update it:


"Xplore GlideRecord Script" Tool


"Preview in Background Script" Tool


"Preview GlideRecord Script" Tool



You'll end up with a script similar to this:



(function() {


      var gr = new GlideRecord('wf_workflow_version');


      gr.addEncodedQuery('checked_out_by=javascript:gs.getUserID()^ORpublished=true^name=Test - Catalog Item')


      //gr.setLimit(100);


      //gr.setWorkflow(false);


      //gr.autoSysFields(false);


      gr.query();


      while (gr.next()) {


            gr.table = "incident";   //or whatever table you need


            gr.update();


      }


})();



Just add lines 9 and 10 to update the table name and you should be good to go.   You can run the script in the Background Scripts page or James.Neale's excellent Xplore tool.