- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2013 12:32 AM
Hi Community,
I am trying to create custom workflow stages in the problem module to display on a list, similar to request items and knowledge, however the workflow is not displaying correctly (see attached screenshot).
I have created a new field, "u_workflow_stages" as per the wiki, populated with workflow stage choices
https://wiki.servicenow.com/index.php?title=Creating_a_Workflow_Field
I have created my workflow using these stage names.
I have added a global business rule as per the wiki.
https://wiki.servicenow.com/index.php?title=Custom_Workflow_Stages
NOTE: The newest code in this doesn't work in my instance (throws lots of errors) so I'm using and older snippet that at least doesn't throw errors.
We have a similar set up on the sc_req_item table and that works fine.
function problem_u_workflow_stageGetChoices() {
var context = new Workflow().getContexts(current);
if (context.next())
getWorkflowChoices(context);
}
function getWorkflowChoices(context) {
var wfs = new WorkflowStages();
wfs.setWorkflowVersion(context.workflow_version.toString(), context.sys_id.toString());
wfs.ignoreApproval();
wfs.getChoices(current.u_workflow_stage, answer);
}
All my workflow stages show, but they all show the state (Pending - has not started), regardless if they have been completed.
Checking the workflow on each individual tickets, each activity is in it's correct state, its just not being reflected in the list.
I was wondering if anyone has a solution or found the same thing?
And yes I have logged with Service Now support, where they appear to be stumped or claim this OOTB functionality as a customization, being out of scope for support.
Thanks in advanced for your help. Currently on Berlin.
===========================================================
Solution
I have self-solved the issue.
See wiki artilce exert below:
4.2 Using the Legacy Renderer
Workflows that use legacy rendering rely on script includes to populate stages. All workflows on instances prior to the Dublin release use legacy rendering. The Legacy renderer preserves this behavior for the Dublin release and later. Starting with the Dublin release, use an alternative renderer to control the display of workflow icons whenever possible.
When using the legacy renderer, a workflow author can create and reference a custom workflow field icon set by setting the icons attribute to a new script include.
For example, to use the WorkflowIconsSCR script include to define which icons to use, add the attribute icons=WorkflowIconsSCR to the Attributes field of the dictionary entry for the workflow field. To use default icon display behavior, use the attribute icons=WorkflowIconsStages.
In the request item module, we were using icons=WorkflowIconsSCR, so I set the dictionary attribute field to this for my workflow stage field.
Clearing the attributes field now makes it display correctly.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2013 07:28 PM
I have self-solved the issue.
See wiki artilce exert below:
4.2 Using the Legacy Renderer
Workflows that use legacy rendering rely on script includes to populate stages. All workflows on instances prior to the Dublin release use legacy rendering. The Legacy renderer preserves this behavior for the Dublin release and later. Starting with the Dublin release, use an alternative renderer to control the display of workflow icons whenever possible.
When using the legacy renderer, a workflow author can create and reference a custom workflow field icon set by setting the icons attribute to a new script include.
For example, to use the WorkflowIconsSCR script include to define which icons to use, add the attribute icons=WorkflowIconsSCR to the Attributes field of the dictionary entry for the workflow field. To use default icon display behavior, use the attribute icons=WorkflowIconsStages.
In the request item module, we were using icons=WorkflowIconsSCR, so I set the dictionary attribute field to this for my workflow stage field.
Clearing the attributes field now makes it display correctly.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2013 01:42 PM
Does your workflow include Approval steps?
I had similar issue, and I got it solved setting the "approval" column to the correct state (approved); It's linked with Stage somehow,
Please let me know if this tip helps you,
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2013 06:03 PM
Our workflow does have an approval stage but the approval column is displaying the correct status.
We also tried removing the approval stage and it still does not display the correct workflow states.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2013 10:46 AM
We added a custom stage to the reqeusted item workflow for one of our clients by modifying the script include. I would suggest that you look into the script include once again and see what sets those stages to Running status.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2013 06:05 PM
Hi MKhan - I've tried removing all references in the Workflow script include that give a stage a pending state.
However, all stages were still set to pending regardless.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
