- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 06:10 AM
I have a form that creates a Business Application , on submitting the form it actually creates a Request item for the approval , as we have a list of approvers in the Requested Item, on selecting a one approver it takes to the approval form , when we click the approve button in the approval form it should redirect to the newly created business application form.
Kindly help me with this Requirement.
Solved! Go to Solution.
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 03:02 AM
Hello Prakash,
As far as I understood your requirement a request is submitted to create a Business application and once the request is submitted, RITM will be created with some approvals on it. When your asked to when some approver opens the approval record to approve the RITM, they click on Approve button on sysapproval_approver table and the RITM is approved. Now once it is approved by clicking on Approve button, the Approve button should redirect to newly created Business Application.
Your business application is created from the Flow that you have created. If that is the case then I believe this is not possible to implement because there is no relationship between the Business Application record and sysapproval_approver table. Also when you click on the Approve button the flow will take say 500ms or 1 second so in this case how the Approve button script will identify if the Business Application is created or not
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 12:36 AM
Hi Ankur,
Yes , the approver is approving using sysapproval_approver button.
Thanks,
Prakash Yadav.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 12:59 AM
Hi,
then you will have to update the OOB ui action which is at form level
So on click of Approve button it should be redirecting to the business application for which approval is happening?
If yes then do this
if(current.source_table == 'cmdb_ci_business_app'){
var url = '/cmdb_ci_business_app?sys_id=' + current.document_id;
current.state='approved';
current.update();
action.setRedirectURL(url);
}
else{
current.state='approved';
current.update();
new ApprovalUserFeedback().approved(current);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2022 10:51 AM
Hi Ankur,
Thanks, but after clicking the approve button it did not redirected to the new business application record .
I believe i should change only the url in the above code
var url= 'domain.servicenow.com/cmdb_ci_business_app?'+ current.document_id;
Still did not work , Kindly help on it.
Thanks,
Prakash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2022 05:37 AM
Hi,
are you sure you are using Form UI action?
Script I shared should work fine.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 08:48 AM
Hi Ankur,
Yes the user is approving from the sysapproval_approver button.
But, the UI Action is neither setting the approval value nor creating the application
It looks Everything is working out in Workflow , below is how the work flow activities are working out
If new App--->Approval (Activity definition:Approval-user) workflow Activity with condition(activity.result == 'approved' || activity.result=='rejected')--->Mark as Approved (If approved)--->Create an Event(notification to manager)---> Create an App
where would you like me to place the given code Or would you suggest me some other code in this scenario, Please help on it.