Using the Send to Azure Function Activity¶
Legacy (Process Designer)
This page describes the Send to Azure Function activity of Process Designer. It was replaced by the Call External API step in Workflow, which calls any public HTTPS endpoint and sends the WorkItemId header. For new work, use Your own endpoint and Call External API.
The Send to Azure Function activity allows you to run custom code as part of your process. The activity will trigger an Azure Function to run, passing to it the context for the batch in process.
Configuring the Activity¶
You will need the Azure Function URL to configure the activity. This can be found by doing the following:
Obtain the Azure Function Url¶
- Login to your Azure Portal at https://portal.azure.com.
- Select All Resouces, and select the App Function resource. This will be the resource with App Service listed under Type.
- In the left-hand navigation, locate your Function (Function1 in this example), and click the function name.

- Click the </> Get function URL link.
- Ensure the key is set to default (Function key) and click the Copy button on the right side of the pop-up.
Add the Function Url to the Activity¶
- Navigate to your KnowledgeLake site and open the Designer app.
- Create or Open a process in edit mode.
- Add the Send to Azure Function activity under Remote Activities from the toolbox into your process at the desired location.
- Double-click or click the edit button to open the activity configuration.

- Paste the copied URL into the URI field and set your Timeout in Milliseconds, which will be how long the activity waits for a response before erroring.
- Click Save Settings.
Using the Batch Context in the Azure Function¶
When a batch enters the Send to Azure Function activity in a process it will trigger an instance of the function. It will also push context data to the function so you know which batch to work with using the API.
In your Function, you will want to create a class as follows:
public class StepDefinitionRequestDTO
{
public Guid WorkItemId { get; set; }
public Guid HoldId { get; set; }
public string KLAPIURI { get; set; }
}
That way you can deserialize the context object that is passed over in the request:
var requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var data = JsonConvert.DeserializeObject<StepDefinitionRequestDTO>(requestBody);
req is the HttpRequest object in your function.
Now you are able to call the KnowledgeLake API using data as your context. - WorkItemId - This is the Id for the batch. - HoldId - The Id for the Hold on the batch. You generally do not need to do anything with this data. - KLAPIURI - This is the uri you will want to use to create your client object as it will give you the url of the environment that called the Azure Function.
You can always harcode the server url if desired, but
KLAPIURIallows you to call the same Azure Function from more than one KnowledgeLake environment.
Releasing the Hold¶
You will need to release the Hold on the batch at the end of your Azure Function. Failing to do so will leave the batch On Hold in the Send to Azure Function step. You can release the hold on a batch by doing the following at the end of your Function:
await processingClient.ReleaseHold(new KLOpenAPI_WorkItemIdentifierParameter() { BatchId = batchId });
¶
await processingClient.ReleaseHold(new KLOpenAPI_WorkItemIdentifierParameter() { BatchId = batchId });
Once this is configured, you can use the same code to call the KnowledgeLake API as you will find in any of our examples.