Hello all
I recently found this post back from awhile ago. https://answers.laserfiche.com/questions/70701/REST-API--Workflow-Web-Service
In the post, the Laserfiche Developer makes mention of two "hidden parameters" that exist in Workflow and they can be passed when starting a Workflow. These two Hidden Parameters are $SyncWebAddress and $SyncMethod.
We were able to utilize these parameters and make a webhook in PHP that gets a response back from a workflow. This response also contains output parameters that the developer can set in workflow. The response comes in XML.
So one can pass $SyncWebAddress = "URL of webhook" and $SyncMethod = "WebService" and have the Workflow POST to a Webhook. This examples just writes the response to a JSON file, but obviously other methods could be used.
<?php $headerStringValue = $_SERVER["HTTP_LFWF_INSTANCE_ID"]; $fileName = "$headerStringValue.json"; $data = file_get_contents("php://input"); $xml = simplexml_load_string($data, "SimpleXMLElement", LIBXML_NOCDATA); $json = json_encode($xml, JSON_PRETTY_PRINT); file_put_contents($fileName, $json);
With the output file consisting of
{ "Parameter": { "@attributes": { "Style": "Output", "Name": "message", "Multivalued": "false" }, "Values": { "Value": "Hello World 9\/14\/2021 1:17:57 PM" } } }
I understand using this method there could be some concerns, long running Workflows, etc, I get all that, but I have questions surrounding hidden parameters in Workflow
- What other hidden Parameters exist when starting a Workflow with the Workflow Web Services? Right now I only have two, is there more? I can't find any documentation pertaining to them other than the one workflow answer from several years ago.
- What OTHER SyncMethods exist? Obviously more $SyncMethods have to exist besides "WebService", otherwise SyncMethod wouldn't even be an option, I would just pass $SyncWebAddress and be done. Can I do something like
$SyncMethod = File
$SyncFilePath = "C:\PathToFileHere.xml" ?
Thanks!