{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":25769,"path":"it-asset-management/saas-license-management/create-sublow-get-activity.md","title":"Create a subflow to get user activity","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a subflow to get user activity\n\nCreate a subflow to update the Software Subscription table with each user's most recent activity in the SaaS application.\n\n## Before you begin\n\nThis subflow requires a data stream action to get user activity. For more information, see [Create a data stream action to get user activity](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-asset-management/saas-license-management/create-data-stream-get-activity.md).\n\nRole required: flow\\_designer\n\n## About this task\n\n**Note:** For examples of subflows to get user activity, see the Jira Update User Activity and Webex Update User Activity subflows.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Flow Designer** &gt; **Designer**.\n\n2.  Click **New** and then select **Subflow**.\n\n3.  On the form, fill in the fields.\n\n<table id=\"table_dk4_brb_njb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nValue\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nName of your choice. For example, *Application* Update User Activity, where *Application* is the name of the SaaS application you’re integrating with.\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\n**Software Asset Management - SaaS License Management** **Note:** If you save the subflow in the Software Asset Management - SaaS License Management application, it’s included with your Software Asset Management subscription. If you save the subflow in any other application, you may be charged for ServiceNow® Integration Hub transactions. If you’re publishing your custom spoke application on the ServiceNow Store, select your custom app instead.\n\n</td></tr><tr><td>\n\nAccessible From\n\n</td><td>\n\n**All application scopes**.\n\n</td></tr><tr><td>\n\nCategory\n\n</td><td>\n\nLeave this field empty.\n\n</td></tr><tr><td>\n\nProtection\n\n</td><td>\n\n**None**.\n\n</td></tr><tr><td>\n\nIn-Flow Annotation\n\n</td><td>\n\nLeave this field empty.\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nDescription of your choice.\n\n</td></tr><tr><td>\n\nRun As\n\n</td><td>\n\n**User who initiates session**.\n\n</td></tr></tbody>\n</table>4.  Click **Submit**.\n\n5.  Add an integration profile input and a look back time input.\n\n    |Label|Name|Type|Mandatory|\n    |-----|----|----|---------|\n    |Integration profile|integration\\_profile|Reference.Integration Profile|Yes|\n    |Look back time|look\\_back\\_time|Date/Time|Yes|\n\n6.  In the Actions section, click the plus icon and then click **Action** to add a new action.\n\n7.  Select the spoke for the SaaS application that you want to integrate with from the list of installed spokes.\n\n    **Note:** To add additional spokes to your list of installed spokes, request them on the [ServiceNow Store](https://store.servicenow.com). For a complete list of available spokes, see [IntegrationHub available spokes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/integrate-applications/spokes-list.md). If there’s no existing spoke for the SaaS application that you want to integrate with, you can [create a new spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-asset-management/saas-license-management/create-saas-spoke.md).\n\n8.  Select a data stream action to get user activity.\n\n9.  Add the **Look back time** subflow input as the value to pass to the **Look back time** input for the data stream action.\n\n10. Define the values to pass for any user authentication inputs for the data stream action.\n\n11. Add the **Update User Activity If Later Using User** action from the Software Asset Management spoke as a child of the get user activity data stream action.\n\n12. Use values from the Data panel to complete the action.\n\n    |Field|Value|\n    |-----|-----|\n    |Last activity|Date of most recent activity from the targetObject.|\n    |Integration profile|Integration profile input that you created for the subflow.|\n    |External user id|User id or account id from the user targetObject. This id is generally a numeric and non human-readable value. This value must be unique.|\n    |User principal name|Email address from the user targetObject. If an email address isn’t available, use another value such as user name plus user id. This value should be human readable.|\n\n13. If you want to use more than one data stream action to get multiple types of user activity, repeat steps 6 through 12 to add each data stream action to the subflow.\n\n14. Click **Test** to test your subflow.\n\n    1.  View the test results and system logs for details about any errors.\n\n        To view system logs, navigate to **System Logs** &gt; **System Log** &gt; **All**.\n\n15. After verifying that the subflow is working as expected, click **Publish**.\n\n    **Tip:** You can still edit the subflow after it's published.\n\n\n"}}