I am trying to use the DOCX From Dynamic Template smart service which requires the images data to be passed in the form of dictionary such that the key in the dictionary is the imageKey (text) and value is list of documents.
I have input like say, ri!imageKey (text) = "logo" and ri!images (list of documents) = {appianDocument1, appianDocument2}. Here appianDocument1 and appianDocument2 is of type Document and should be of type document in the final dictionary.
I want to generate:
{
logo: {appianDocument1, appianDocument2}
}
Can anyone help me to achieve this?
Thanks
Discussion posts and replies are publicly visible
You don't need the key in the dictionary to be dynamic, because you will be specifying/hard-coding that exact key in your docx template like this - «[#list logo as logo]».
Hi Omkar,
Thank you for replying. But in our case we are using this smart service to generate documents from various dynamic documents where we want to pass the Document Template, XML data for that document and the Image data depending on the document we want to generate. So even if we are specifying/hard-coding the exact key in the documents, it varies for every document template, in some case some have multiple Imagekeys.
Find working code below. In the plugin Dictionary Manipulation you find a function createDictionary which seems to work in the same way, but it does only support singular primitive data as value. My solution is not restricted. Make ri!key a text and ri!value an any type.
=a!fromJson( substitute( a!toJson({tzqYx62_01_: ri!value}), "tzqYx62_01_", ri!key ) )
@stefan I am using your method in the integration, it is not giving output as expected. While same method is applied in the expression rule, it's working. As the dictionary is getting replaced with new keyword as "2". Please help me resolve this issue.
This is so much 2020 style ...
Use a!update to add any field to a given map or dictionary. This can also be an empty one.
Actually update wouldn't work, For generic purpose and business usecase I'm passing rule input 'data' as dictionary and passing diffrent dictionary for various scenario. In integration one thing is permanent that is case reference. And after the case reference I want to apply my data as it is genric. Pls give a resolution for this.
{ CaseReferences: { CustomerCaseReference: "7885",caseId : "125" }, here I want to put my data as key value pair for example : CaseStatusChange: { CaseStatus: "Case_Concluded" }
As this dictionary will automatically convert into json
Sorry, I do not understand what you want to achieve. Using a!update(), you can do any dictionary manipulation you want.