--- title: Use cases requiring modification of the source extension JSON configuration slug: '1943' canonical_url: https://docs.coveo.com/en/1943/ collection: index-content source_format: adoc --- # Use cases requiring modification of the source extension JSON configuration The **Add extensions** panel offers a **JSON** tab where you can see and modify the whole source extension configuration details (see [JSON Tab](https://docs.coveo.com/en/2001#JSON)). You can use this tab to help troubleshoot source extension configuration, but also to change the configuration. The following table indicates specific indexing pipeline extension use cases that you can only achieve by modifying the source extension JSON configuration. > **Note** > > You can easily apply an extension to a source from the Coveo Administration Console (see [Apply an extension to a source](https://docs.coveo.com/en/1936/)), and then modify its JSON configuration rather than writing it from scratch. [%header,cols="2"] |=== |Use case |Description |[[Parameters]] Pass parameters a|A good practice is to reuse indexing pipeline extensions across two or more sources to prevent creating and having to manage several similar script variants. You may not be able to reuse an extension because the code needs information that varies from one source to another and that isn't available in item metadata. In such a case, the usage of extension parameters could allow you to pass the variable information your code needs to be reusable. On the **JSON** tab, you can include one or more parameters and their value such as `Param1`, `Param2` and `Value1`, `Value2` in the following source extension configuration sample: ```json { "common": { "preConversionExtensions": [ { "condition": "", "extensionId": "myorg-vwrthh2s6lw5lcibrsut7cknsu", "parameters": { "Param1": "Value1", "param2": "Value2" }, "versionId": "", "actionOnError": "SKIP_EXTENSION", "name": "NameOfMyExtension" } ], "postConversionExtensions": [] }, "items": {} } ``` In your extension python script, you can get the passed parameter values from the `parameters` array. ```python # Getting `param1` and `param2` parameter values passed from the source extension configuration a = parameters[`param1`] b = parameters[`param2`] ​ # Adding metadata with these values document.add_meta_data({`extparam1`:a,`extparam2`:b}) ``` |[[Version]] Execute a specific extension version a|Each time you modify and save an extension, you create a new extension version. By default, the indexing pipeline uses the latest extension version. In some cases, like when you actively develop and extension, you may want to temporarily apply the "stable" version of the extension, not the very last that you saved. You can get the extension [version ID](https://docs.coveo.com/en/1645#edit-or-restore-an-old-version-of-an-extension) from the [**Extensions**](https://platform.cloud.coveo.com/admin/#/orgid/content/extensions/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/extensions/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/extensions/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/extensions/)) page. On the **JSON** tab, you can specify the `versionId` parameter to force to use a specific extension version: ```json { "common": { "preConversionExtensions": [ { "extensionId": "myorg-vwrthh2s6lw5lcibrsut7cknsu", "parameters": {}, "versionId": "5XSihxzII4vsirD6jUlVlDeYIkz90z5U", "name": "NameOfMyExtension" } ], "postConversionExtensions": [] }, "items": {} } ``` |[[actionOnError]] Action on error a|You can use the optional `actionOnError` parameter to specify what to do when the extension returns an error. The following table describes the available `actionOnError` parameter values: [%header,cols="2"] !=== !Value !Action when the extension returns an error !SKIP_EXTENSION !The extension is skipped for the item, as if it had never ran, and the item continues to be processed in the indexing pipeline. Default value. !REJECT_DOCUMENT a!The item is rejected so it's excluded from the index. Use this value when the extension purpose is essential to the item searchability. **Example:** Your extension modifies item permissions. If the script returns and error, you can't guarantee that the item permissions will be set correctly. You want to ensure that you don't create a security hole by making possibly sensitive information searchable by unauthorized users. You add `"actionOnError": "REJECT_DOCUMENT"` to the source extension JSON configuration. ```json { "common": { "preConversionExtensions": [ { "extensionId": "myorg-retgvf2s6lw5lcibrsut7cknsu", "parameters": {}, "actionOnError": "REJECT_DOCUMENT", "name": "SetPermissions" } ], "postConversionExtensions": [] }, "items": {} } ``` !=== |===