1
0
-1

Hi,

I have a problem which I use JSON Tool as a post form submission tool. In my JSON Tool with post method, I use JSON Payload to submit data in joget form into external website like this,

{
    "CoID":"#form.mtn_uom.CoID#",
    "UomCode":"#form.mtn_uom.UomCode#",
    "LastUpdateDate":"#form.mtn_uom.LastUpdateDate#"
}

But, the form data hash variable that I used, not retrieve any data, 

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hey there!

      You may refer to the sample photo attached below. I've tested and it works well.

      By using the Form Data Hash Variable without mentioning a record ID, this hash variable expects a process context to be able to implicitly obtain a record id as a reference to lookup for its specified column.

      Hence, for your solution, trying appending a record ID in your Form Data Hash Variable. You can learn more here: Hash Variable#FormDataHashVariable

      Hope this helps!

      1. Justin

        Also, don't forgot to perform JSON API Authentication when consuming Joget JSON APIs. You can learn about it here: https://dev.joget.org/community/display/KBv6/JSON+API+Authentication

      2. NFMJ

        But I am using external rest api for this tool. Can use the same json payload for external rest api?

      3. NFMJ

        You give the hard code for Activity ID, are they any ways to get activity id or form ID by using hash variable? as you can see, I use this hash variable { "CoID":"#form.mtn_uom.CoID[{form.mtn_uom.id}]#", "UomCode":"#form.mtn_uom.UomCode[{form.mtn_uom.id}]#", "UomStatus":"#form.mtn_uom.UomStatus[{form.mtn_uom.id}]#" }

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

      I already try using form data hash variable, form binder and workflow, but still not able to work. I got this error in my server log everytime I run the process

      {
      	"ValidationResults": [ 
      	{
      		"Success": false,
      		"Message": "Company ID value is required and cannot be empty",
      		"MemberNames": [
      			"CoID"]
      	},
      	{
      		"Success": false,
      		"Message": "UOM ID value is required and cannot be empty",
      		"MemberNames": [
      		    "UomCode"
      		]
      	}
      	],
      	"Status": 400,
      	"Result": "",
      	"ResultObject": null
      }
      1. Justin

        Hey there, Looking at the hash variables you appended in the comments above, the nested hash variables also does not seem to have access to any process context. Is this form being used and tested by running a process? or tested with a form menu/CRUD menu?

      2. NFMJ

        The form used by running process

      3. NFMJ

        I already find the solution by using the workflow variable as nested hash variable. Tq for your effort, I really appreciate it.

      CommentAdd your comment...