Using URL On Submit to Access Next Task/Work Item (eForm Events)
Is there anyway in AgilePoint to reference the next task ID in the process other than the one option for email notifications if you set them on the future next task activity itself?
If not, is there then a way to use/modify the eForm Events w/ Javascript (onBeforeSubmit or onSubmit) in order to automate the "take task" functionality from the work center?
-----------------------------------------------------------------------------------------------------------------------------------------
We are trying to redirect the user automatically to the next task in the work center in processes where the person submitting the form would always be the individual working the next task. Ideally where the submit button could take them to the next task in the process. I realize using the "sections" could replicate this functionality but in our circumstance we need to heavily make use of sub processes.
This would create a more seamless application for our users and would avoid them using the work center inbox to take tasks and hopefully automate this process. This also creates a smoother flow for applications that do not require approval processes and simply want to step to the next part of the data entry application (such as a sub process).
Any insight would be greatly appreciated!
-
I am aware of changing the URL on submit and use this in an application already to redirect them to the start page and this has been wonderful and exactly the flow I am trying to replicate with a multiple form process model if at all possible.
My issue is that I am trying to have the URL on Submit direct the user automatically to the next activity in the process model without being forced to claim the task from the inbox. This does not seem possible at first glance so I thought I would see if anyone else has tried to implement the same functionality. It seems the TaskID/Work Item ID does not update until the next form is physically called to be loaded.
Right now the only way I can avoid excessive inbox use is with sections in the form and step through the business process that way instead of individual forms. There are times when we may like to have a user automatically directed to the next work item id in their inbox. Kind of similar to how the email notification allows you to send a link directly to the next task without ever touching your Work Center or Inbox located in AgilePoint.
In the end if we got his functionality it would create re usability between similar forms and a seamless experience for the user so they do not have to "leave" the application when they hit the submit button.
-
So I use a Landing page/Home page eForm and side step the whole work center thing. Mostly some basic JS
NotifyAppCustomConstants.js
if (!NotifyAppCustom) var NotifyAppCustom = {};
if (NotifyAppCustom.hasOwnProperty('UrlConstants') == false)
{NotifyAppCustom.UrlConstants = {};
if (NotifyAppCustom.hasOwnProperty('Generic') == false )
{
NotifyAppCustom.UrlConstants.Generic =
{
URL: 'http://xxxx:13491'
}
}if (NotifyAppCustom.hasOwnProperty('FormsAndPortal') == false)
{NotifyAppCustom.UrlConstants.FormsAndPortal =
{
MasterFormUrl: NotifyAppCustom.UrlConstants.Generic.URL + "/ApplicationBuilder/eFormRender.html?Process=" + "Home Page Process"+ "&FormMode=1",
ANUSubmitForm: NotifyAppCustom.UrlConstants.Generic.URL + "/ApplicationBuilder/eFormRender.html?Process=" + "Recreation Permit Application Process"}}}
and another file for buttons
CustomNavigation.js
function btnBackToMasterForm() {
try {
window.open(NotifyAppCustom.UrlConstants.FormsAndPortal.MasterFormUrl, "_self");
} catch (e) {
alert(e);
}
}function btnANU() {
try {
window.open(NotifyAppCustom.UrlConstants.FormsAndPortal.ANUSubmitForm, "_self");
} catch (e) {
alert(e);
}
} -
We had a similar case for our tenant a while back, and after a bunch of support tickets, we finally figured out how to do this.
Write a SQL query to AP's cloud database to grab the Task ID of the current task in the process, then compose the URL and dump it on SharePoint.
In the parent process, set two variables: the display name of the form and the return path for the schema. Pass these two variables to the SQL subprocess, then let it do its thing and return the URL.
You can then use that URL in an email or, like us, on SharePoint.
Unfortunately, I can't upload .zip files on the forum, so hopefully the two screenshots and a bunch of code below can help.
UPDATE PROCESS DATA 1:
ParentProcessID = ${ParentProcessID}
SqlQuery = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("SELECT TOP 1 WORK_ITEM_ID FROM [WF_MANUAL_WORKITEMS] INNER JOIN [WF_ACTIVITY_INSTS] on [WF_ACTIVITY_INSTS].ID = [WF_MANUAL_WORKITEMS].ACTIVITY_INST_ID WHERE [WF_MANUAL_WORKITEMS].PROC_INST_ID = '" + (${/pd:AP/pd:processFields/pd:Process/pd:ParentProcessID} as string) + "' AND [WF_ACTIVITY_INSTS].DISPLAY_NAME = '" + (${/pd:AP/pd:processFields/pd:Inputs/pd:ActivityDisplayName} as string) + "' AND [WF_MANUAL_WORKITEMS].STATUS != 'Completed' AND [WF_MANUAL_WORKITEMS].STATUS != 'Cancelled' ORDER BY [WF_MANUAL_WORKITEMS].LAST_MODIFIED_DATE desc"));
WCF:
REST Request URL: ${AgilePointExtensionAPIUrl}/FetchUsingEncodedData (where the global variable has the value of: https://devas1.nxone.com/AgilePointServer/Extension ) This one's weird: when testing, put in the URL, but if you have a Dev Tenant and a Prod Tenant, you'll want to switch between tenants quickly, so we made identically named global variables on each tenant whose values point to different URL's. So to run the test, like when you need to map the return value in a few steps down from here, replace the variable with the full URL. Remember to swap back to the global variable when done mapping/testing.
Settings: POST, JSON, JSON, HTTP 1.0, 600, 600, 600
Header needs an authorization that you'll have to enter your AP credentials. This can't be an external user, so I had to make an AgilePoint login and make it an administrator over my tenant so that it could authorize this query. UserName: nxone\YourUserName, then generate and Insert it.
Custom Payload: {"encodedData":"${/pd:AP/pd:processFields/pd:Process/pd:SqlQuery}"}
Save Response to Custom Attribute: RestOutput
UPDATE PROCESS DATA 2:
RestOutputModified = (${/pd:AP/pd:processFields/pd:Process/pd:RestOutput} as string).Replace(" ","").Replace("<\\/","</");
TaskId = (${/pd:AP/pd:processFields/pd:Process/pd:RestOutputModified} as string).Contains("WORK_ITEM_ID") ? ((${/pd:AP/pd:processFields/pd:Process/pd:RestOutputModified} as string).Substring((${/pd:AP/pd:processFields/pd:Process/pd:RestOutputModified} as string).IndexOf("<WORK_ITEM_ID>") + ("<WORK_ITEM_ID>").Length, (${/pd:AP/pd:processFields/pd:Process/pd:RestOutputModified} as string).IndexOf("</WORK_ITEM_ID>") - (${/pd:AP/pd:processFields/pd:Process/pd:RestOutputModified} as string).IndexOf("<WORK_ITEM_ID>") - ("<WORK_ITEM_ID>").Length)) : string.Empty;
IsError = (${/pd:AP/pd:processFields/pd:Process/pd:TaskId} as string) == String.Empty ? true : false
TaskLink = String.Concat(${LinkToTask_Prefix}, ${/pd:AP/pd:processFields/pd:Process/pd:TaskId})
CONDITIONAL:
IsError == false, then proceed; else send an email to our team inbox so we're aware that a process is missing a link and we can manually add it if necessary.
UPDATE PARENT PROCESS:
Give the schema input value as the return path, and TaskLink as the return value.
Now, here's how to use the subprocess:
UPDATE PROCESS DATA 1:
ApTaskDisplayName = "Queue Form" (Notice the name of the form above; you should change this name to match your display name of the form in question.)
Schema_TaskFormLink = "/pd:AP/pd:processFields/pd:Task/pd:L/pd:TaskForm" (Update this to match the return path you want.)
SUBPROCESS:
Map the two variables above to the ActivityDisplayName and the schema variable to whatever's in your Update Parent Process activity in the subprocess.
Whew! From here, you can send an email with the link to the form or you can dump it on SharePoint (which you see is the Update Metadata activity in my screenshot).
-
Karl,
I'm little confused with this solution.
I understand the logic, but i can't reproduce with success.
It's possible you put the zip file in my Google Drive?
Thank you so much.
https://drive.google.com/drive/folders/16TLtPYvpAeNZ1qBhNS_OXkLN188gBPkl?usp=sharing -
Hi Karl,
I do not reproduce with success, like i said before.
This is my test process (testing put task link on "Submit" button).Explaining:
- Define Link to "Resultado" task.
This define link to next task "Resultado", to put this in actual task "Simulador".- Define Link to "Documentos" task.
This define link to next task "Documentos", to put this in actual task "Resultado".- Define Link to "Envio" task.
This define link to next task "Envio", to put this in actual task "Documentos".But i receive the error below in RestOutput:
"Endpoint not found."If i use URL with "FetchUsingEncodedData" operation, i receive the error:
Thanks for any help.
-
I'm using the public cloud, so this documentation helped me locate REST endpoints in the past; however, it seems like the link is now broken:
https://documentation.agilepoint.com/11/developer/restapiOpenSwaggerURL.html
I'm not sure where to access REST endpoints on a private server, unless that link works for your environment. If it helps, the public cloud API that I'm using is https://devas1.nxone.com/AgilePointServer/Extension
A 400 error means that some configuration within the REST activity is incorrect. Since there are so many variables and options, it's not something a forum like this can easily debug. My first recommendation is to check all process variable references and make sure you're copying your own variables instead of using the ones I pasted. My second recommendation is to hard-code all the values you need directly into the activity to generate the proper response data and schema mapping, then replace the hard-coded stuff with variables and save it. If you use variables when attempting to configure the activity, they all get replaced with a blank string in the simulations.
I'm uncertain if I'm allowed to copy the zip file into your Google Docs. Maybe the AgilePoint App Store can open up to user-made apps pretty soon.
-
For all, who are looking for webhosting service around the world. squarespace We are available 24x7. We are hosting Service Provider.
Please sign in to leave a comment.
Comments
12 comments