Copy link to clipboard
Copied
I am attempting to use PDF Services Document Generation Module via Adobe Fusion. No matter what value I place into the Data for Merge parameter I cannot get the JSON object to work. I have tried as a string, and as a Collection, I have tried as a single param and a mapped param. No combination seems to work. I'm just looking for someone who has gotten this to work before.
I can put in hard-coded individual values and get it to work but that is not very useful when I have many documents each with a unique structure, I don't want to have to set up a single module for every file we have. Any guidance would be great, thanks!
Hi Graham,
It's possible. You just need to pre-generate the arguments as an Array[] with each element in the array conforming to the syntax of { "key": "X", "value":"Y", valueType: "Z" }. Instead of specifying the values individually in the PDF module, you turn the 'map' switch on so you can pass this array.
Here's an arbitrary example that downloads a template from Workfront, makes the aforementioned Array with some hello world values, makes the PDF, and then sends it to myself.
Copy link to clipboard
Copied
Hi Graham,
It's possible. You just need to pre-generate the arguments as an Array[] with each element in the array conforming to the syntax of { "key": "X", "value":"Y", valueType: "Z" }. Instead of specifying the values individually in the PDF module, you turn the 'map' switch on so you can pass this array.
Here's an arbitrary example that downloads a template from Workfront, makes the aforementioned Array with some hello world values, makes the PDF, and then sends it to myself.
Copy link to clipboard
Copied
Thanks for your reply. I tried setting mine up in the same way however, I seem to be getting a missing value error coming from the valueType field. Which is odd because I am not exposing it. See the runtime error below.
Copy link to clipboard
Copied
Check the contents of json_string. It should look like this:
[
{
"key":"Field_1",
"value":"Field_1_Value"
"valueType":"value"
},
"key":"Field_2",
"value":"Field_2_Value"
"valueType":"value"
}
]
You'll need to adjust your aggregator after you change the structure to now collect the field,fieldType,valueType instead of field_1,field_2
Copy link to clipboard
Copied
Never mind, I see you have the custom JSON structure. I think I can make it work now. Is this published anywhere? It does not seem to appear anywhere in the Document Generation documentation. I think the only places this appears is in the parameters for the actual API calls and it is not explicitly clear that the JSON should carry information beyond field name and value. Might be worth adding a paragraph to the Workfront-specific docs. I think most people trying to set this up in that env might not have a lot of API experience. Anyhow, Thanks!
Copy link to clipboard
Copied
So, I thought I had this sorted out but it still is not working. I am still getting a valueType validation error. I tried removing and re-adding the module and the error persists. Here are all my module settings. Perhaps I have been looking at this for so long that I cannot see a simple misconfiguration. Any ideas are welcome.
Copy link to clipboard
Copied
Here's a better screen shot that shows the options selected in the aggregator.
Copy link to clipboard
Copied
It's difficult to tell. What values are checked off in the Array aggregator? It looks blank.
Can you look at the input bundle? (it's the little download button above your error message)
Copy link to clipboard
Copied
I put up a new screenshot showing the items checked in the aggregator. Yes, the input bundle is showing empty. I think it always shows empty on a validation error.
Copy link to clipboard
Copied
Something is strange, that looks correct. What does the output of the aggregator indicate?
Copy link to clipboard
Copied
Looks like this which looks correct to me.
Copy link to clipboard
Copied
That looks correct to me also.
Try deleting the PDF operation and putting a new one in its place. It shouldn't make a difference but I'm at a loss as to what the issue is. Your array contents from the image above are the exact same structure as mine.
Copy link to clipboard
Copied
Same error. I will try re-creating the scenario from scratch.
Copy link to clipboard
Copied
I re-created the scenario from scratch and I still get the same error. THis is the only thing I can think of that would be different at this point: What does the json you use to feed the Document Generation plugin to create the fields look like?
Copy link to clipboard
Copied
This is the input bundle from the PDF Generation module.
Copy link to clipboard
Copied
I mean what does the json look like that was used to set up the fields in the actual word doc using the Document Generation Plugin?
Copy link to clipboard
Copied
I didn't use the dogen plugin, but the fields look like this in the document:
{{firstName}} {{lastName}}
Copy link to clipboard
Copied
I tried a new Word file with simple tags and I am still getting the same error.
What version of PDF Services are you using?
Copy link to clipboard
Copied
I've tried this with both version 1 and version 2 of the module.
Copy link to clipboard
Copied
So I got this to work by changing the tags to {{<field_name>.value}}. Now I want to place all of these fields in a repeating section. Not sure what the JSON would need to look like to handle multiple iterations. Can you give me a hint on that?
Would it be like this?
{"products":[
{"1":{ "key":"field1", "valueType":"array", "value":"test1"}},
{"2":{ "key":"field2", "valueType":"array", "value":"test2"}},
]}
Copy link to clipboard
Copied
I sure can.
The 'tasks' item is a three column table containing a name, status, and duration.
Note that it's valueType is array. There are no valueTypes on the rows themselves - just straight JSON object.
It would be precisely like this:
Copy link to clipboard
Copied
This was a huge help, thanks!
Copy link to clipboard
Copied
You're most welcome!