Using URL On Submit to Access Next Task/Work Item (eForm Events)

Comments

10 comments

  • Avatar
    Scott Bennett

    Sure

    In settings for your form change the URL for the submit button

    like

    http://xxx:13491/ApplicationBuilder/eFormRender.html?Process=Home%20Page

     

    0
    Comment actions Permalink
  • Avatar
    Stephan Lefebvre

    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.

    0
    Comment actions Permalink
  • Avatar
    Scott Bennett

    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);
    }
    }

     

     

    0
    Comment actions Permalink
  • Avatar
    Lucas Drege

    Stephan, does Scott's suggestion help?

    If not, let us know, I've spoken with our Professional services team on this, and they'd be glad to have a call with you to go over it.

    Lucas

    0
    Comment actions Permalink
  • Avatar
    Leandro de Oliveira Fernandes

    Hi,

    This post has resolved?
    I have the same problem.
    How redirect user, from the start task, directly to next form (next task in process)?
    Can you share?

    Can i use the link, from next task, in submit button url?

    Thanks.

    0
    Comment actions Permalink
  • Avatar
    Karl Makatenas

    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).

    1
    Comment actions Permalink
  • Avatar
    Leandro de Oliveira Fernandes

    Karl, thanks for this response.
    I will apply this solution and make some tests.
    This is a very good solution, thank you so much.

    1
    Comment actions Permalink
  • Avatar
    Leandro de Oliveira Fernandes

    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

     

    1
    Comment actions Permalink
  • Avatar
    Leandro de Oliveira Fernandes

    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.

    0
    Comment actions Permalink
  • Avatar
    Karl Makatenas

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.