We’re currently experiencing a high volume of support requests, which may result in longer response times — thank you for your patience and understanding.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This documentation is for the new preview UI. It’s still being refined and is subject to change. For documentation for the old UI, see Knowledge Base.

Article link copied to clipboard
Updated
Published
4 min read

This tutorial will walk you through some basic concepts of workflow creation. You will:

  • Fetch data from the Lansweeper connector
  • Learn how data flows between steps of a workflow
  • Use a loop to iterate over the records you fetch
  • Use logical branches to determine what to do with each record
  • Send certain records to another system (this example uses Slack)

The workflow you build will fetch data (a list of assets) from your Lansweeper Site, loop over the list, determine which assets have a location, and notify you via Slack of the corresponding assets and their location.

Add location to assets

If you do not have any assets with a location in your inventory, you can edit a few assets in your Lansweeper Site to test this workflow.

  1. In your Lansweeper Site, go to Inventory.
  2. Select a few assets, then select Bulk edit.
  3. Select Location from the dropdown.
  4. Enter a location, then select Save and apply.

Create a Slack app and have access to a Slack workspace

You must create a Slack app before creating a workflow to connect Lansweeper and Slack.

  1. To create a free Slack app, follow the instructions under Slack OAuth 2.0.
  2. While creating the app, ensure to assign your Slack app the chat:write, chat:write.public, and channels:read scopes.

Create a new workflow

  1. In your Lansweeper Site, go to Flow Builder > Add new WorkFlow.
  2. Select Quickstart to create a new workflow from scratch.
  3. Enter a name for your workflow, such as “My First Workflow.”
  4. Select Universal webhook as your trigger, then Create trigger.

universal webhook

Fetch assets’ data from Lansweeper

  1. Add a new step to your workflow by selecting the + icon below your trigger.
  2. Enter Lansweeper in the search.
  3. Select List of assets from the list to add it as a step.
  4. Select Add a string input.
  5. From the dropdown, select asset.location.location.

Test the Lansweeper connector

  1. Select Run.
  2. Under Steps, select List of assets.
  3. In the Output tab, you can view the data fetched from the Lansweeper connector.

Important notes regarding execution and visualization

  • In the Items list, there is a maximum number of 250 elements shown. This is just a visual limitation.
  • If you get a message like <data (123456 bytes)>, it’s a known visualization constraint. Temporarily reduce the number of records via Max Records to preview data.

Create a Loop over items

Now that we're fetching a list of assets, we need to loop over each asset to determine if they have a location.

  1. Under the List of assets step, select the + button.
  2. Enter Loop in the search.
  3. Select the Loop > Repeat for each action.
  4. Select the Reference icon in the Items textbox.
  5. Select the Items property, then Save.
  6. Select Run.
  7. Under Steps, select Repeat for each.

The loop step will have a currentItem property which we'll use next.

Identify assets with a location

Now that we're looping over each item, we need to determine whether the current item has a location.

  1. Under the Repeat for each step, select the + button.
  2. Enter Branch in the search.
  3. Select Branch > IF condition is met.
  4. Under Condition, enter Has a location?
  5. Under Field, select Reference.
  6. In Reference path, use: currentItem.asset.location.location and select Save.
  7. Under Operator, select Exists.

Steps with asset.location.location set will follow the Has a location? branch.


Send assets with location to Slack

Next, we want to send a message to Slack for each asset with a location.

Ensure you have a Slack app created
You’ll need credentials setup now for Slack (Client ID, Secret, etc.).
See Create a Slack app and have access to a Slack workspace

  1. In the Has a location? branch, select the +.
  2. Enter Slack in the search.
  3. Select Post message.
  4. Select Add connection.
  5. Enter your Client ID, Client Secret, and Signing Secret.
  6. Select Connect to allow access to your Slack application.

Now configure the Slack step:

  1. For the Message input, you can format it like:
    The asset "currentItem.asset.general.name" is located in "currentItem.asset.location.location".
    To reference previous steps, you need to click on the Reference icon, select Repeat for each, and add the corresponding path in the reference path field.
  2. Select Run to test.
  3. Under Channel Name or ID, select the channel you want to post the message to.

Next steps

Congratulations! You created your first workflow! Here are a few things you should try next:

  • Send your message to a different system, like Microsoft Teams.
  • Swap out the List of Assets action for something else like Software or Vulnerability list.
  • Write your messages out to a file in Dropbox or Amazon S3.