{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":45919,"path":"security-management/vulnerability-response/create-domain-separated-imports.md","title":"Create domain-separated imports for an integration","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create domain-separated imports for an integration\n\nIf you require imported data to be in a specific domain, the user assigned to run the integrations must belong to that domain.\n\n## Before you begin\n\nRole required:\n\nimport\\_admin and the configure integration role for your specific integration, for example, sn\\_vul.configure\\_r7\\_integration or sn\\_vul\\_tenable.configure\\_integration.\n\n## About this task\n\nThis set of tasks requires coding or advanced ServiceNow expertise.\n\nThe import queues contain data attachments that the scheduled jobs \\(integrations\\) process. In a domain-separated environment, you must match the scheduled job with the correct import queue.\n\n## Procedure\n\n1.  Create a domain.\n\n2.  For every domain you create, create a user and assign the user to that domain.\n\n    Think of this user as a **run\\_as** placeholder for the domain in your vulnerability integration. It is the equivalent to the **VR.System** user in the global domain. This user needs access to data sources, transform maps, and vulnerability data.\n\n    **Note:** Do not use this user for any other purpose.\n\n3.  Create a scheduled job in each domain.\n\n    For more information on additional precautions and settings, see [Additional settings for domain separation](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/vulnerability-response/ds-additional-config.md).\n\n    1.  Navigate to **All** &gt; **System Definition** &gt; **Scheduled Jobs**.\n\n    2.  Copy **Scheduled Vulnerability Data Source Processor** into the domain.\n\n    3.  To identify the scheduled job, append the domain to the name.\n\n        \\[Omitted image \"DomainScheduledJob.png\"\\] Alt text: Domain scheduled job form.\n\n    4.  In the **Run as** field, change the **run\\_as** user to the user you created in the Step 2.\n\n    Starting from v20.1 of Vulnerability Response, the following script changes are shipped with the base system.\n\n4.  **Note:** Edit the following UI action so that the integration runs in the **run\\_as** user domain.\n\n    Edit the **Execute Now** UI action in the **Qualys Host Detection Integration** integration job to add this code block to the top of the file.\n\n    ```\n    //sys id below is of host detection integration\n    if(current.sys_id == \"5d9cf0daff540300c68c9f783894fa4d\"){\n    current.run_as = gs.getUserID\n    ();\n    }\n    \n    ```\n\n5.  **Note:** Edit the following script includes so that integration run in the **run\\_as** user domain.\n\n    Edit the **VulnerabilityIntegrationUtils** script include method **addIntegrationRun** to add the highlighted code\n\n    \\[Omitted image \"addIntegrationRun.png\"\\] Alt text: addIntegrationRun script include method.\n\n6.  Edit the **VulnerabilityIntegrationUtils** script include method, **addProcessRun** to add the highlighted code in the following image.\n\n    addProcessRun code\n\n    \\[Omitted image \"addProcessRun.png\"\\] Alt text: addProcessRun script include method.\n\n7.  Edit the **VulnerabilityIntegrationUtils** script include method, **copyProcess** to add the highlighted code in the following image.\n\n    copyProcess code\n\n    \\[Omitted image \"copyProcess.png\"\\] Alt text: copyProcess script include method.\n\n8.  Edit the **DataSourceVulnReportRefreshProcessor** script include method **\\_processFromDataSourceGroups** to change this original code:\n\n    Original \\_processFromDataSourcesGroups code\n\n    \\[Omitted image \"processFromDataSourceGroupsOrig.png\"\\] Alt text: Original \\_processFromDataSourceGroups original entry.\n\n    To:\n\n    Edited \\_processFromDataSourcesGroups code\n\n    \\[Omitted image \"processFromDataSourceGroupsFinal.png\"\\] Alt text: Edited \\_processFromDataSourceGroups.\n\n9.  Edit the **VulnerabilityDSAttachmentManager** script include method, **queueItem** to add the following highlighted code blocks\n\n    queueItem\n\n    \\[Omitted image \"queueItem.png\"\\] Alt text: queueItem function.\n\n    \\_getNext\n\n    \\[Omitted image \"getNext.png\"\\] Alt text: \\_getNext function\n\n    \\_processQueueEntry function\n\n    \\[Omitted image \"processQueueEntry.png\"\\] Alt text: processQueueEntry function.\n\n    At this point, you are ready for domain-separated imports.\n\n    **Note:** If you have multiple deployments of a Vulnerability Response or Application Vulnerability Response integration, repeat this process for each deployment.\n\n\n-   **[Create and support multiple domains in the background jobs framework](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/vulnerability-response/create-support-multiple-domains.md)**  \nBackground jobs in vulnerability response products are designed to run for long periods of time to perform multiple processes on your records. The background job processors are shipped with the base system that run via the system user and create records in the global domain.\n\n**Parent Topic:**[Advanced Vulnerability Response configuration tasks](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/vulnerability-response/setup-tasks-optional.md)\n\n"}}