Create approval from task

Blaze2
Kilo Guru

I have a requirement to create an approval from a task.  

We want that when someone requests an application for our app store, that it be vetted first by the Mobility Support team. Once Vetted, if accepted the tech will click on submit for approval (closed complete) an approval will go to the Mobility Support Manager. Upon his approval it will revert back to the Mobility support team to retrieve the application and place it in the app store.

If not accepted by the Mobility Support Team,   in the initial stage, the tech will click Invalid Request (closed incomplete) and the workflow will cancel out there.

My issue is at the beginning. The task is being created from the initial request, but once it hits the if statement, (if closed complete create approval) everything starts to whack out. Depending on how I place the values either Submit for approval.

I have done the following.

Flowed directly from the SCTask to the Approval - Fail

                                                      Invalid request closed task as Closed Incomplete but created Approval   - this is incorrect

                                                    Submit for approval closed complete task, created approval - this is correct

Flowed directly from SCTASK to If Condition from if condition to set values (rejection) - Fail

                                                        Invalid Request Cancelled the work flow, and set state to closed incomplete. did not create approval - correct

                                                        Submit for approval Cancelled the work flow, and set state to closed incomplete. did not create approval   - incorrect

Flow from ScTask to Wait for condition, (if state is not one of - Pending, Opened, work in progress)   - to if condition (state is closed complete)( - yes to approval, no to rejection) - fail

                                                      Invalid Request Cancelled the work flow, and set state to closed incomplete. did not create approval - correct

                                                      Submit for approval Cancelled the work flow, and set state to closed incomplete. did not create approval   - incorrecta

I really need assistance in setting up script or someone telling me the if statement is not working properly. Below I have attached the workflow as I have it now which is still not functioning properly

find_real_file.png

1 ACCEPTED SOLUTION

Following up with screenshots.   Once you add the new conditions your workflow will look something like this:


find_real_file.png



I just renamed "Always" to Approved and set a condition.   It looks like this:


find_real_file.png



Then I right clicked on the Catalog task and added a new Condition, named it Rejected and added a condition:


find_real_file.png



Hope this helps.


View solution in original post

5 REPLIES 5

shill
Mega Sage

Can you post a screenshot of your If conditions or script?


And I am not sure of the purpose of the Wait for Condition in the workflow as well. Can you explain?


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

I believe your issue is that you need the state of the Catalog Task to base your IF condition on.   The workflow executes in the sc_req_item table and the catalog tasks are stored in the sc_task table which is creating your issue.



When a child task is closed, the activity.result value is set to the State of the task at the time of closure.   So what I would suggest is add additional conditions to your Catalog task activity so you can branch from there.   To do this, right click on the activity and select "Add Condition".   Name it to something like "Closed Complete" and then the condition would be activity.result == '3', add another for "Closed Incomplete" and the condition would be activity.result == '4' and so on.   If you really only care about Closed Complete, you could just rename the "Always" condition (double-click on the yellow always to edit it) to something like Rejected and make its condition activity.result != '3'



Then you can branch from that activity to create the approval or set the value to rejection.


Following up with screenshots.   Once you add the new conditions your workflow will look something like this:


find_real_file.png



I just renamed "Always" to Approved and set a condition.   It looks like this:


find_real_file.png



Then I right clicked on the Catalog task and added a new Condition, named it Rejected and added a condition:


find_real_file.png



Hope this helps.


Michael,



Sorry for the late reply.   I copied exactly how you instructed, had my fingers crossed the whole time and thankfully, this was the result that I needed. Thank you so much for assisting me.