Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tiagomacul
Mega Sage
Mega Sage

how to add show workflow?

 

You can looking for UI Action > name starts with Show Workflow

https://<instance>.service-now.com/nav_to.do?uri=%2Fsys_ui_action_list.do%3Fsysparm_query%3DnameSTARTSWITHShow%2520Workflow%26sysparm_first_row%3D1%26sysparm_view%3D%26sysparm_choice_query_raw%3D%26sysparm_list_header_search%3Dtrue

 

doesn't exists... you can create.

A change_task table example

01. Menu system UI > UI Actions

find_real_file.png

02. 

name: Show Workflow

Table: change_task

onclik: showWorkflowContext()

condition: !current.isNewRecord() && (new Workflow().hasWorkflow(current))

script

function showWorkflowContext() {
   var id = g_form.getUniqueValue().toString();
   var url = new GlideURL('context_workflow.do');
   url.addParam('sysparm_stack', 'no');
   url.addParam('sysparm_table', g_form.getTableName());
   url.addParam('sysparm_document', id);
   g_navigation.open(url.getURL(), "_blank")
}

 

 

 

 

Comments
Pabitra Subudhi
Tera Contributor

how we can make the same work in workspace client script.

tiagomacul
Mega Sage
Mega Sage

Pabitra Subudhi

 

 i think you're talking about this discussion. did you see it?

 

https://www.servicenow.com/community/developer-forum/run-workflow-from-client-script-then-retrieve-v...

 

var wf = new Workflow()

 

//Get the workflow id

 

var   wfId = wf.getWorkflowFromName("Comprehensive Change");

 

//Start workflow, passing along name : value pair(s) for mapping to variable

 

//where input_var_name is the name of the variable declared in gear menu

 

//and input_var_value is whatever that value should be for this execution of

 

//workflow

 

var context = wf.startFlow(wfId, null, "Workflow Name", {"test": "test"});

 

gs.print("context: " + context.id);

 

for(x in context){

 

gs.print(x + "     " + context[x]);

 

}

Version history
Last update:
‎06-06-2018 04:07 PM
Updated by: