1
0
-1

I've created a very simple process with just 2 activities. Via the UI I can start the process, and then move the process through the two activities, and finally to completion.  I can see the record in the Inbox and List Views that I've created (which should show everything).  However, when I start a process via the JSON API, the process does not show up in the UI.   I've checked the Running Processes list and I can see both the process that I created via the UI and the one created via the API.  Both processes appear to be identical in settings and status. What would cause the one created via the API to not appear in the applications UI?

Note: I'm logged into the UI as 'admin' and I'm interacting with the API as 'admin' as well, so I'm assuming it's not a permissions issue. 

Here's how I start the process via the API:

web/json/workflow/process/start/sik002_POC:5:frmPatient_approver_process?var_patientId=api423

It returns a success response with the processId.  I can then use that processId to interact with the process via the API but I never see it in the UI.

Thanks

    CommentAdd your comment...

    6 answers

    1.  
      2
      1
      0

      Hi Seth Klock,

      Yes, there's actually an API for this. Once you have obtained the process instance ID from the API that you called, you can call the form data related API to insert a record row. Please see https://dev.joget.org/community/display/KBv6/JSON+API#JSONAPI-web/json/data/form/store/ 

      Hope this helps.

      Thanks.

      Hugo

      1. Seth Klock

        Thanks Hugo. I've been using V5. Looks like it's time to upgrade.

      CommentAdd your comment...
    2.  
      2
      1
      0

      You can change your design, put a tool at the front.

      Use the "Database Update Tool" to run something like the following

      insert into app_fd_YOURTABLENAME values (id, name) ('#assignment.processId#','#variable.wfField1#')

      in order to get the data row inserted so that your datalist inbox will have record showing up.

      1. Seth Klock

        Thanks Walter. That was very helpful. I've implemented this and it seems to be working well. I have to admit that it still seems like there should be a way to populate form data via the API. As in my example, if a form field is "linked" to a workflow variable, then it should create the record for that form. Perhaps this could be added to a future release.

      CommentAdd your comment...
    3.  
      2
      1
      0

      Hi Seth,

      I have just tried to follow the steps and able to see the assignment created as a result of starting a process instance via API. Please see the screenshot of mine.

      I can see the assignment created in Inbox in the Userview. If you are using Datalist Inbox, you may not see it until you have a form record row created for the process instance. Starting a process instance by itself will not create a record row.

      Perhaps you can attach your app design and server error log here for us to check.

      Thanks.

      Hugo

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi,

        After going through the above thread, and reviewing the APIs was able to figure out it's now possible with API to start a process with data that could be listed on Datalist Inbox.

        This has to be done through two API calls:

        1. Form Data API - Store (JSON API#web/json/data/form/store/(*:appId)/(*:formId)/(*:primaryKeyValue)) here we need to specify the Primary Key Value (primaryKeyValue)

        2. Processes API - Start (JSON API#web/json/workflow/process/start/(*:processDefId)) here we need to start Workflow process with the same Primary key from Step 1 passed under parameter recordId


        This may help future users of the Joget, just in case they are struggling to figure out the relation between Process & Form and finding it difficult to start with the APIs.

          CommentAdd your comment...
        1.  
          1
          0
          -1

          Hello Anders and Hugo

          Thanks again for the feedback.  I was able to figure out why the form and datalist field content wasn't in sync.  So the outstanding issue is that I can't find a way to get the record to show up in a standard List or Datalist Inbox until I have added content via the UI.  Attached is a new sample app that demonstrates this.  APP_skApiTest-1-20170829130343.jwa

          1. Post the following to the API: web/json/workflow/process/start/skApiTest:4:process1?var_wfField1=api853
          2. You will then find a record in the Inbox, but not in the List or Datalist Inbox. 
          3. Open the record in the UI and add some content to "Field 2".  
          4. Save the record as a Draft. 
          5. Now you will find the record in both the List or Datalist Inbox.  

          Hugo, earlier you mentioned "you may not see it until you have a form record row created for the process instance. Starting a process instance by itself will not create a record row.".  How can I create a form record row via the API?

          Thank you, 

          Seth

            CommentAdd your comment...
          1.  
            1
            0
            -1

            Hello Hugo, 

            Thank you for your reply.  That was extremely helpful.  As you suspected, I was using a Datalist Inbox.  I have now added a standard Inbox to my Userview and I'm able to see the processes that have been started via the API.  How can I create a record row via the API so that the record automatically shows up in the standard Inbox when created via the API?  If I update the row from the Standard Inbox it starts to show up in the Datalist Inbox after that, but I need to be able to push the activities along via the API or UI and have them behave the same way. 

            At the moment, the process that I've built goes thru 2 Activities.  On Process start I set a PatientId.  Activity 1 is to add the First Name, and Activity 2 is to add the Last Name (I just setup these steps as a simple example to learn how it works).  What's strange is that when I start the process via the API and set the PatientId variable, I'm able to see the record in the Inbox, and then complete Activity 1.  From the form I can see the PatientId that I set via the API, but when I then look at the record in the Datalist inbox, the PatientId column is empty.  In other words, the PatientId displays in the form but not the grid.  Any idea what would cause that?  (see screen shot)

            Attached you will find an export of my app design.  APP_sik002_POC-1-20170824120714.jwa

            Thanks a lot for the help. 

            Seth

             

            1. Anders

              Hi, if you are designing steps to fill up a form, perhaps using a https://dev.joget.org/community/display/KBv5/Multi+Paged+Form might be easier and more suitable?

            2. Seth Klock

              Thanks Anders. That looks like a nice option. I should have mentioned that the form in my example was just a silly thing that I created for testing the API. Do you think that using the Multi Page Form would have any bearing on the API issue that I'm experiencing? Thanks

            CommentAdd your comment...