{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":25766,"path":"it-asset-management/saas-license-management/create-subflow-get-license-consumption.md","title":"Create a subflow to get license consumption","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a subflow to get license consumption\n\nCreate a subflow to add license consumption data to the Subscription Consumption Summaries \\[sam\\_saas\\_consumption\\_summary\\] table.\n\n## Before you begin\n\nThis subflow is applicable to any integration that uses the SaaS license connection framework, including custom integrations.\n\nRole required: flow\\_designer\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Process Automation** &gt; **Flow Designer**.\n\n    The Flow Designer launches in a new tab.\n\n2.  On the Flow Designer home page, click **New** and then select **Subflow**.\n\n    The Subflow Properties dialog box opens.\n\n3.  On the dialog box, fill in the following 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\nSubflow Name\n\n</td><td>\n\nName of the subflow. For example, `Download License Consumption`.\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nDescription of the subflow.\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\nApplication scope to which you want the subflow to apply. Set this field to **Software Asset Management - SaaS License Management Integrations**.**Note:** If you save the subflow in the Software Asset Management - SaaS License Management Integrations application scope, it's included with your Software Asset Management subscription. If you save the subflow in any other application scope, you may be charged for ServiceNow® Integration Hub transactions. If you're publishing your custom spoke application on the ServiceNow Store, select your custom application scope instead.\n\n</td></tr><tr><td>\n\nAccessible From\n\n</td><td>\n\nApplication scope from which the subflow is accessible. Set this field to **All application scopes**.\n\n</td></tr><tr><td>\n\nCategory\n\n</td><td>\n\nSubflow category. Leave this field empty.\n\n</td></tr><tr><td>\n\nProtection\n\n</td><td>\n\nRead-only protections for your subflow. Set this field to **None**.\n\n</td></tr><tr><td>\n\nSublow Annotation\n\n</td><td>\n\nMessage that appears under the subflow title in the subflow picker. Leave this field empty.\n\n</td></tr><tr><td>\n\nRun As\n\n</td><td>\n\nOption to specify whether the flow runs as a system user or user who initiates the session. Set this field to **User who initiates session**.\n\n</td></tr><tr><td>\n\nRun with role\\(s\\)\n\n</td><td>\n\nRoles with which this subflow runs.\n\n</td></tr></tbody>\n</table>4.  Click **Submit**.\n\n    The Flow Designer creates the draft subflow and then redirects you to the subflow configuration page.\n\n5.  From the subflow configuration page, add an integration profile input.\n\n    1.  Under INPUTS &amp; OUTPUTS, click the plus icon \\(+\\) to add an input for your subflow.\n\n    2.  In the Inputs section, click the plus icon \\(+\\).\n\n    3.  When prompted, enter the following information for your integration profile input.\n\n        |Label|Name|Type|Mandatory|\n        |-----|----|----|---------|\n        |Integration profile|integration\\_profile|Reference.Integration Profile|Yes|\n\n    4.  Click **Done**.\n\n6.  Add a data stream action for getting license consumption data.\n\n    1.  Under ACTIONS, click the plus icon \\(+\\) and then select **Action** to add a new action.\n\n    2.  When prompted, select the **Global** spoke from the list of INSTALLED SPOKES.\n\n    3.  From the list of Default actions, select **Get &lt;saas-application&gt; Consumption**.\n\n    4.  Click **Done**.\n\n7.  Add an Upsert Consumption action as a child of the Get &lt;saas-application&gt; Consumption action.\n\n    The Upsert Consumption action uploads license consumption data to the Consumption Summary table on your ServiceNow instance.\n\n    1.  Under the Get &lt;saas-application&gt; Consumption action, click the plus icon \\(+\\) and then select **Action**.\n\n    2.  When prompted, select **Software Asset Management** from the list of INSTALLED SPOKES.\n\n    3.  From the list of Default actions, select **Upsert Consumption**.\n\n        The Upsert Consumption action inputs appear.\n\n    4.  From the Product \\[Software Product\\] list, search for and select the software product that you are connecting to with your integration.\n\n        This value must be a reference to the Software Product \\(samp\\_sw\\_product\\) table. If the product does not exist in the table, [add a custom software product](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-asset-management/software-asset-management/t_AddACustomProduct.md).\n\n    5.  Use values from the Data panel to fill in the remaining action inputs.\n\n        Your request to the SaaS API may not return data for all inputs. Fill in the inputs that are applicable to your integration.\n\n        |Field|Value|\n        |-----|-----|\n        |Version|Version of the SaaS application.|\n        |Edition|Edition of the SaaS application, such as `Standard` or `Enterprise`.|\n        |Unit of consumption|Unit of measure for the software units that can be consumed.|\n        |Total units|Total number of software units that you have purchased across all active entitlements for the software product.|\n        |Units consumed|Total number of software units that your users have consumed.|\n        |Contract start|Start date of your contract.|\n        |Contract end|End date of your contract.|\n\n    6.  Click **Done**.\n\n8.  Verify that your subflow is working properly by clicking **Test**.\n\n    View the test results and system logs for details about any errors in your subflow. You can view system logs by navigating to **System Logs** &gt; **System Log** &gt; **All** in your ServiceNow instance.\n\n9.  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## What to do next\n\nView analytics such as subscription usage, cost, and compliance of your SaaS applications on [SaaS overview dashboard in workspace](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-asset-management/software-asset-management/saas-dashboard-workspace.md).\n\n"}}