Skip to content

This guide provides instructions and information about Stanford Web Services Jumpstart platform, based on Drupal 7.

We've released our new Stanford Sites on Drupal 8 (D8) platform — the new framework for Stanford Sites in 2020 and beyond. Check out our new User Guide to help you set up your website on the D8 platform. 

Read more about our road to D8 

Filtering Imported Profiles from CAPx

Filtering Imported People Profiles from CAP

Filtering was added to the CAPx module in version 2.1, and allows you to selectively choose which profiles from an importer are actually imported to your site. They are best used when importing a group of profiles, such as via a workgroup or an organization code. A set of Filters is associated with a single importer.

Prerequisites

  1. Ensure that you have CAPx 2.1 or newer with the capx_filters module enabled on your site. If you are unsure, please contact us for support.

  2. Ensure that CAPx is Connected for your site.

  3. Filters require an existing importer; create a new importer if needed.

    1. If creating a new importer, do not import the profiles after the Importer is created.

    2. If adding filters to an existing importer, the filters will not affect entities that are already imported, unless the Remove existing on match option is enabled to target profile entities to be deleted by the filter.

Adding Filters to an Importer

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Import.

  3. On your Import list page, click on the Filters action next to the importer you would like to filter:

 

 

  1. Click the Add New Filter button.

  2. On the Add Filter page, you will need to enter the CAP API path for the field that you would like to filter on. Use the Data Browser on the right to help search for the path, or in a separate window, pull up the mapper that is associated with your importer to recall the CAP API path you used.

    1. The CAP API path does not need to be directly mapped to a field for filtering to occur on that data. You may filter on any data included in a profile.

 

  1. In the Value field, enter the value you would like to filter for.

  2. In the Comparison operation dropdown, select the type of operation you would like to run between the CAP API path and the Value.

    1. For example, if you enter $.names.preferred.firstName in CAP API path, Jon in Value, and Text > Contains in Comparison operation, only profiles whose preferred first name contains Jon will be imported. This will also import profiles with preferred first names as Jonathan.

    2. Text value comparisons are not case sensitive. So searching for Jon will match JON and jon.

    3. Alternatively, you can also check the Exclude content with this value box to negate the operation. That is, all profiles in the importer will be imported except those whose preferred first names contain Jon.

  3. Click Save to save your filter. It will now appear in your Filters list:

 

 

  1. Repeat as needed to add more filters to the same importer.

  2. After a filter has been created you can either run the Importer manually or wait for the next automatic run to have the new settings applied.

 

Note: Filters are run with the and condition. That is, profiles will need to satisfy all of the filters in order to be imported. If you would like to import profiles as an or condition, you will need to create a duplicate importer of the same profiles, and then add your or conditions to the duplicate importer. For example:




This set of filters will cause the importer to only import profiles whose preferred first name contains jon and whose titles do not include the word professor.

Editing a Filter on an Importer

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Import.

  3. On the Import list page, click on the Filters action next to the importer which has the filter(s) you would like to edit.

  4. On the Filters list page, click the Edit action next to the specific filter you would like to modify.

  5. On the Filter edit page, change the fields as needed.

  6. Click Save when finished.

  7. After editing a filter you can either run the Importer manually or wait for the next automatic run to have the new settings applied.

Deleting a Filter on an Importer

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Import.

  3. On the Import list page, click on the Filters action next to the importer which has the filter(s) you’d like to delete.

  4. On the Filters list page, click the Delete action next to the specific filter you would like to delete.

  5. Click Delete to confirm deletion of that filter.

  6. After a filter has been deleted you can either run the Importer manually or wait for the next automatic run to have the new settings applied.

Using Filters to Delete Imported Profiles

While you can use filters to control which profiles are imported from an Importer, you can also use filters to bulk delete profiles.

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Import.

  3. On the Import list page, click on the Filters action for the importer you’d like to delete against.

  4. Add filter(s) to the importer following the directions above.

  5. On the Filters list page, check the box for Remove existing on match. This will delete content that matches these filters. For example:

    will delete all previously imported profiles where $.names.preferred.firstName does not contain jon and where $.longTitle.title contains professor.

  6. Click Save to save the setting.

  7. The next time the importer is run (either manually or automatically), the filters will be run and any profiles that do not pass the filters will be deleted.

Notes and Troubleshooting

  • The CAP API path does not need to be directly mapped to a field for filtering to occur on that data. You may filter on any data included in a profile.

  • A set of filters are tied to a specific importer. If you would like the same filters applied to another importer, you will need to re-create the filters on the other importer.

  • If you are not importing the profiles you are expecting, double check your filters to ensure that they are set correctly.

    • Filters are run with the and condition. That is, all filter conditions must be satisfied for profiles to be imported.

    • Text comparisons are not case sensitive.

    • If no profiles are importing, first check to make sure that your importer is importing correctly without filters. This may cause profile entities to be created, which will have to be deleted if you did not want them to be imported.

    • Check the error logs under reports for more information on errors and warnings.

  • Enable the Remove existing on match option to have filters delete profiles that do not pass the filters. Remove existing on match requires at least 1 filter to be active.

  • Deleting an importer will delete all filters associated with it.

  • Filters are run after the importer fetches the data from the CAP API, and before the creation of the content.

  • Saving any filter (new or existing), or saving the Filters Delete option will cause the importer to sync all profiles during the next sync.