I have a function I am trying to build as a generic robot in itself, so that multiple other processes can feed the work into this robot. The robot would be basically to “populate letters” similar to a mail merge function, to simply take a Word document filepath and perform a Replace Text on all key pairs stored in a dictionary, so that the letter is populated with personalised content (eg. FirstName replaced with “John”). I want this function to be able to process on all items that are added to its queue, using the Queue Item content as its data to drive from.
I have the following items in my dummy Queue item required for processing:
replaceValues (Dictionary of String,String)
This works fine for my test scenario. However… if I have another robot add items to this robot Queue to populate the letters, I am wondering what I can do to ensure that the above variables are included in the Queue Item content, as I would required those variables in the exact same format and naming. Because if not found, robot cannot process.
Any ideas on how I could do this? Is it possible to make required variables on Queue items somehow, or what could be an alternative solution? For instance - what if the developer wants to utilize this robot to produce letters. They know the robot expects the document path and a dictionary of values to replace in the letter template, but they might name it differently like “WordFilepath” and “myDictionary” even though they have provided the values necessary
Or does it come down to simply a matter of strict documentation on these “Function” robots - listing all the expected inputs and naming conventions. Any time people want to send jobs to the robots, they need to refer to documentation and include as expected.
Maybe when reading the queue items with the robot, you can incorporate to check the transaction, does it have the data you are expecting.
Additionaly you can set the mandatory data schema form in json format when creating Queue.
You validate the data in the transaction in your process that picks up the transaction. This is called your performer. The dispatcher(s) put items into the queue, and the performer picks them up and does the letters. It’s that performer that should check that all required data is in the transaction, and either process it or throw a Business Exception.
Ahh yes I see what you are saying. So it seems like what I am trying to do is have 1 Performer robot (produces letters), but multiple Dispatcher robots (could be all totally different processes that eventually require a letter produced), and I am trying to make it so these will add items to the Performer queue with the expected variables and naming conventions.
I was looking for a way to make it so that ‘documentPath’ and ‘replaceValues’ would be required variables when dispatching to the performer.
@Petar_Soce is correct here for capabilities available - To ensure only Queue Items that match the required structure are used this is where the Schema Definitions: Specific Data JSON Schema comes into play. If the provided Queue Item does not validate it will reject the addition of the Queue Item before the Performer ever sees it as a “Pre-validation” step.
Specific Data JSON Schema Optional. File size limited to 256kb by default.
Enables you to upload a JSON schema for the specific data of all transactions in the queue. All transactions added to the queue must adhere to the schema or an error will be triggered and the request to add the transaction will fail. Note: The uploaded schema is not enforced retroactively, existing transaction items are not affected.
You can visit http://json-schema.org/ for more information on the JSON Schema and specification versions, by default if not specified draft-07 will be used where the latest as of this reply is 2020-12
I would still validate/sanitize as a good practice, any queue items processed by your performer, especially if you do not control the source Input.