**Source URL:** https://medical.veevavault.help/en/gr/57354/

# Configuring Medical Inquiry CRM Data Sharing (MedInquiry)

Medical Inquiry CRM Data Sharing allows you to share account and <a href="/en/gr/52722/">Medical Inquiry</a> data between Veeva CRM and Veeva MedInquiry. For example, when a sales representative creates an inquiry in CRM, MedInquiry pulls the inquiry from CRM to create a _Case_ in Vault, which a call center agent responds to using MedInquiry to generate a response package. When the agent closes the case in MedInquiry, Vault pushes an update, which can include response notes and a link to the response package, back to CRM.

For inquiries that originate in MedInquiry, such as a health care provider requesting information directly from a call center, Vault creates a _MedInquiry Medical Inquiry_ record in CRM if the _Case Contact_ is associated with a CRM _Account_.

Vault uses the following objects to pull and store data from Veeva CRM:

  * **CRM Org**: The _CRM Org_ object stores login credentials, API credentials, and integration and initial sync history for a specific CRM organization.
  * **CRM Data Mapping**: This object creates a field to field mapping between Vault and Veeva CRM.

To use Medical Inquiry CRM Integration, you must have a security profile that grants access and complete the following steps, explained in detail in the sections below:

  * Enable Medical Inquiry CRM Data Sharing
  * Create a CRM Org
  * Add the API Consumer Key and Consumer Secret
  * Enter Salesforce Credentials
  * Populate the CRM Data Mappings Object
  * Execute the Pull Historical CRM Accounts Job

## Enabling Medical Inquiry CRM Data Sharing

You must contact <a class="external-link " href="https://support.veeva.com/hc/en-us" target="_blank" rel="noopener">Veeva Support</a> to enable this feature, then navigate to **Admin > Settings > Application Settings** and select the **Enable Medical Inquiry CRM Data Sharing** checkbox.

## Creating the CRM Org {#crm-org}

### Before You Begin

Vault uses the **CRM Org** record to store login credentials and other information it needs to retrieve data from Veeva CRM. Before you begin, you'll need to create a dedicated integration user account in Veeva CRM for MedInquiry integration. You'll assign all cases you want to pull into MedInquiry to this user. Next, <a class="external-link " href="https://support.veeva.com/hc/en-us/articles/360006272734-How-to-Obtain-a-Consumer-Key-and-Secret-of-Connected-App-in-CRM" target="_blank" rel="noopener">find or create a connected app</a> and gather the following information from Veeva CRM:

  * From _Company Information_, save the _Org Name_ and _Org ID_.
  * From **Setup > App Setup > Create > Apps > Remote API Access**, save the _Consumer Key_ and _Consumer Secret_.
  * The Veeva CRM _Username_ and _Password_ for your dedicated integration user.

### Adding CRM Orgs to Business Admin

Navigate to **Admin > Configuration > Objects > CRM Org** and select the **Display in Business Admin menu** checkbox.

### How to Create a CRM Org Record

To create a new _CRM Org_ record:

  1. Navigate to **Business Admin > Objects > CRM Org** and click **Create**.
  2. Enter the value of the _Org Name_ field you saved from Salesforce in the **Name** field.
  3. Enter the value of the _Org ID_ field you saved from Salesforce in the **CRM Org ID** field.
  4. From the **Integrations** dropdown, select **Medical Inquiry**.
  5. Optional: Select the **Type** of CRM Org for the integration, _Sandbox_ or _Production_.
  6. Select the **CRM Vault Metadata Sync** checkbox.
  7. In the **CRM Username** field, enter the username you use to log into your CRM Org in Veeva CRM.
  8. Click **Save**.

## Adding the API Consumer Key and Secret

From the **Actions** menu, select **Enter Salesforce Credentials**. Enter the **CRM Password, Connected App Consumer Key,** and **Connected App Consumer Secret** that you saved from your Veeva CRM connected app.

##  Populating the CRM Data Mappings Object {#mapping}

The _CRM Data Mapping_ object specifies the field to field mappings between Vault and Veeva CRM along with the picklist translations. You can configure data mappings manually or use <a href="/en/gr/26597/">Vault Loader</a> to upload a CSV.

### Configuring Data Mappings with Vault Loader

To upload a CSV of your data mappings:

  1. Navigate to **Vault Loader > Load** and click **Choose** next to **CSV File**, then select your data mappings file. See the sample CSV below for an example.
  2. Select **CRM Data Mappings** from the _Object Type_ picklist.
  3. From the _Action Type_ picklist, select **Create.**
  4. Click **Map Fields**. Vault will notify you via email when the loader job is complete.

### Configuring Data Mappings Manually

To configure field mapping manually:

  1. Navigate to the **CRM Data Mappings** list page and click **Create.**
  2. Select the **Job Type**. Select **Account** to map data from the CRM _Account_ object. To map data from the CRM _Inquiry_ object, select **Inquiry**.
  3. Select the <a href="/en/gr/57354/#mapping-types">_Mapping Type_</a> from the **Mapping Type** picklist.
  4. Enter the CRM object name and the corresponding Vault object name. For example, the CRM _Account_ object can be mapped to the Vault _Person_(person\_\_sys) object.
  5. Enter the **CRM Field** name and the corresponding **Vault Field** name. For example, the CRM _FirstName_ field can be mapped to the Vault _First Name_(first\_name\_\_sys) field.
  6. For picklist fields, enter the **CRM Picklist Value** and the corresponding **Vault Picklist Value**. For example, **cardiology** and **cardiology\_\_c**.
  7. Optional: Enter the **CRM Default Value** and **Vault Default Value**. For fields that do not map directly to a CRM field, Vault creates records with the default value.
  8. Click **Save**.

### About Mapping Types {#mapping-types}

There are four (4) options available in the _Mapping Type_ picklist:

  * **CRM Default Mapping**: This mapping type defines default values for CRM fields that do not exist in Vault. The **CRM Default Value** field is required for this mapping type.
  * **Vault Default Mapping**: This mapping type defines default values for Vault fields that do not exist in CRM. The **Vault Default Value** field is required for this mapping type.
  * **Field Mapping**: This mapping type configures mapping between a Vault field and a CRM field for all field types except picklists
  * **Picklist Mapping:** This mapping type configures mapping between a Vault picklist/object value and a CRM picklist/object value. You must configure one mapping for each value in a picklist/object. Picklist/objects must be mapped 1:1 between Vault and CRM. Every value in each system must be mapped once.

## Pulling Account Data from Veeva CRM

You can choose to import all CRM account records or only account records created after a certain date. From the **CRM Org** record detail page, click **Edit**. Select the desired **Integration Start Date** for _Accounts_.

From the **Actions** menu on the **CRM Org** record detail page, select the **Pull Historical CRM Accounts** action. Vault notifies you when the job is complete. After the initial sync, Vault populates the **Initial Sync Start Date** and **Initial Sync Complete Date** for _Accounts_. The records from CRM are then available in the corresponding Vault _Case Contact_ object records listing. Once the initial _Pull Historical CRM Accounts_ job runs, Vault pulls new and modified _Account_ records using a scheduled job on a periodic basis.

### Syncing Only Accounts with a Medical Inquiry

There are situations where you may not wish to sync all _Accounts_ from Veeva CRM into Vault.  For example, your organization may have a limited third party agreement (TPA) from a data provider that constrains the quantity of HCP reference data you can pull from Veeva CRM into Vault. 

If this is the case, you can contact Veeva Support to enable the **Only Pull Accounts with Inquiries** feature. 

With this setting are enabled, Vault: 

  * Does not need to pull historical accounts before pulling inquiries.
  * Does not add the _Pull Historical CRM Inquiries_ job or action to the _CRM Org_.
  * Updates the _Recurring Account Pull_ job to only query Veeva CRM for _Accounts_ if a user created a _Medical Inquiry_ since the last successful job.

### Merged Accounts

To support _Accounts_ merged in CRM, set the **Enable Account Merge** checkbox under **Admin > Settings > Application Settings > Enable Medical Inquiry CRM Data Sharing**. This is only available on Vaults with the _CRM Data Sharing feature_ enabled. If you do not see the checkbox, please contact Veeva Support.

When an account merges, Vault records the merge in the _Merged Contact_ object and updates any open _Case_ records associated with a merged account with the new _Case Contact_ of the newly merged account. Vault sets the _Case Contact_ account that was merged into said account to inactive. Vault does not inactivate the account if the _Person_ object uses a lifecycle.

You cannot use merged _Case Contacts_ in _Case_ records.

## Pulling Medical Inquiries

You can choose to integrate all CRM Medical Inquiry records or only inquiry records created after a certain date. From the **CRM Org** record detail page, click **Edit**. Select the desired **Integration Start Date** for _Inquiry_.

To pull records from Veeva CRM, from the **Actions** menu on the _CRM Org_ record detail page, select the **Pull Historical CRM Inquiries** action. Vault notifies you when the job is complete. After the initial sync, Vault populates the _Initial Sync Start Date_ and _Initial Sync Complete Date_ for _Inquiries_. The records from CRM are available in the corresponding _Case_ and _Case Request_ Vault object records listing. Once the initial _Pull Historical CRM Inquiries_ job runs, Vault pulls new and modified _Inquiry_ records using a scheduled job on a periodic basis.  Inquiries are pulled for the window between the last successful _Recurring Account Pull_ job's query time, before the last successful _Recurring Inquiry Pull_ job.

The _Recurring Inquiry Pull_ job relies on the _Recurring Account Pull_ job completing successfully. You must therefore monitor and maintain it to ensure Vault continues to pull _Inquiries_.

We recommend both jobs run hourly to minimize the maximum window between _Inquiry_ pulls with a gap between them, as they cannot run simultaneously.  For example, you can schedule the _Recurring Account Pull_ job at HH:00 and the _Recurring Inquiry Pull_ job at HH:15. You must configure the job times with the API.

**Note**: MedInquiry only pulls inquiries assigned to the designated integration user in Veeva CRM.

### Pulling Custom Response Details

By default, Vault sends _Case Response_ emails for _Cases_ synced from Veeva CRM to the _Case Contact_, synced from the _Account_ in Veeva CRM. You can allow users to specify another email address, similar to a _Response Contact_, to send the _Case Response_ email to instead. 

To configure the additional _Email Address_, you'll first need to <a href="/en/gr/15057/">activate the _Email Address_ field on the _Case_ and _Case Response_ objects</a>, then add the fields to both <a href="/en/gr/26387/#how-to-access-page-layouts">object page layouts</a>.

Next, you'll need to <a href="/en/gr/32857/#assign">add the _Email Address_ field to the _Email_ object type</a> of the _Case Response_ object. You must also <a href="/en/gr/32857/#type-defaults">set the default on this _Email Address_ field</a> to **`case__vr.email_address__v`**.

Finally, you'll need to create a [field mapping][1] between **`email_vod__c`** on the _Medical Inquiry_ object in Veeva CRM and **`email_address__v`** on the _Case_ object in MedInquiry. This ensures that the email address specified in the Medical Inquiry record in Veeva CRM is pushed to the _Email Address_ field on the relevant _Case_ record in MedInquiry.

You can optionally create workflows and user actions to update these fields on _Cases_ and _Case Responses_.

## Pushing Medical Inquiries

To push records from MedInquiry to Veeva CRM, select **Push CRM Inquiries** from the **Actions** menu on the _CRM Org_ record detail page. Vault notifies you when the job is complete and the records from MedInquiry will be available in Veeva CRM. Once the initial _Push Inquiries_ job completes, _Cases_ that are closed in MedInquiry and assigned to a _Case Contact_ pulled from Veeva CRM are pushed to CRM by a scheduled job on a periodic basis.

### Pushing Updates Only to Inquiries Originating in Veeva CRM

The push job can be constrained to only push inquiries that originated in Veeva CRM back to CRM.  To enable this, select the **Only Push Inquiries that Originate in CRM** in **Admin > Settings > Application Settings**. When this setting is enabled, new inquiries created in Vault are not pushed to Veeva CRM.

## Related Permissions

You can complete all steps in this article with the standard System Admin or Vault Owner security profile. If your Vault uses custom security profiles, your profile must grant the following permissions:

| Type | Permission Label | Controls |
| --- | --- | --- |
| Security Profile | Admin: Configuration: Objects: Create | Ability to create new Vault objects. |
| Security Profile | Admin: Configuration: Objects: Edit | Ability to make changes to Vault objects. |
| Security Profile | Admin: Configuration: Object Lifecycles: Create | Ability to create new object lifecycles. |
| Security Profile | Admin: Configuration: Object Lifecycles: Edit | Ability to make changes to existing object lifecycles. |
| Security Profile | Admin: Configuration: Object Workflows: Create | Ability to create new object workflows. |
| Security Profile | Admin: Configuration: Object Workflows: Edit | Ability to make changes to existing object workflows. |

[1]: #mapping