/
Custom Service Contexts

Custom Service Contexts

You may wish to use Send2CRM service contexts to identify which services should be used for particular purposes.

Adding Contexts

New contexts can be added after service registration.

// Add context to a specific service. send2crm.services.addContext('customContext', 'myAlias'); // Omit the alias to add to the default service. send2crm.services.addContext('customContext');

Check if a Service has Context

Test whether a specific service has a context enabled.

let isCustomContext = send2crm.services.hasContext('customContext', 'myAlias');

Find all Services with Context

Use your custom contexts to retrieve a subset of service configurations.

let ctxServices = send2crm.services.getServicesFor('customContext'); // Result: [ { alias: 'myAlias', apiUrl: 'https://example.com', apiKey: '<key>', contexts: ['customContext'] } ]

This will return an array of objects with service configuration data, may be empty if no matches.

Related content

Service Selection for Forms
Service Selection for Forms
More like this
Multiple Services Integration
Multiple Services Integration
More like this
Multiple Services
Multiple Services
More like this
Visitor Analytics to Multiple Services
Visitor Analytics to Multiple Services
More like this
Custom Settings
Custom Settings
More like this
Send2CRM Assistant: Setup
Send2CRM Assistant: Setup
More like this