Why hash variable not able to retrieve data?

Confluence User - 04 Oct, 2018

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, 

form;data;hash;variable;json;tool

10


05 Oct, 2018
confluenceUser
confluenceUser

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!

05 Oct, 2018
confluenceUser
confluenceUser

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

08 Oct, 2018
confluenceUser
confluenceUser

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

08 Oct, 2018
confluenceUser
confluenceUser

Yes. Can.

08 Oct, 2018
confluenceUser
confluenceUser

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}]#" }

08 Oct, 2018
confluenceUser
confluenceUser
08 Oct, 2018
confluenceUser
confluenceUser

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
}
09 Oct, 2018
confluenceUser
confluenceUser

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?

09 Oct, 2018
confluenceUser
confluenceUser

The form used by running process

09 Oct, 2018
confluenceUser
confluenceUser

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

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print