sections in the article
This article provides an overview of a special type of CVLs (Controlled Vocabulary Lists), called custom CVLs. You will find links to articles covering the process of creating a custom CVL, along with different types of information about their use and purpose.
What is a CVL?
CVL is a data type and an Elastic data model concept that presents the user with a predetermined list of values to choose from. This gives you full control over all possible values that can appear in a Field, forcing the users to select one or more predetermined values, avoiding the risk of getting unwanted or misspelled values.
This constraining works by associating a Field type with a predefined list of values in the Elastic data model.
What is a custom CVL?
A custom CVL is a CVL where the CVL values are managed by an extension. Before setting up a CVL so that it is a custom CVL, you still need to create the CVL in the Elastic data model. There is no difference between a normal CVL and a custom CVL when you use the CVLs in your applications.
You can use this special type of CVL if the source of the CVL values is somewhere other than the data model.
In a standard inriver implementation, there are for two predefined custom CVL extensions for the CVLs Users and GroupTask. The values of these CVLs are managed by extensions that get the data from the inriver user list and inriver role list respectively.
When and when not to use custom CVLs?
When to use a custom CVL?
Custom CVLs allow you to have more dynamic values in a drop-down list, values that change depending on different circumstances. Here are two scenarios when a custom CVL could be useful:
- You have a CVL that needs to be updated as soon as possible when something happens in inriver or somewhere else.
- You want the values to change or be limited depending on what kind of user has logged in.
Why not use a custom CVL?
Custom CVLs can be very powerful but should be used sparingly. They should only be included if other options have been exhausted. A custom CVL should be light. An improperly configured custom CVL could cause slowdowns and delays in an environment, or even cause errors.
Research your options before choosing to use a custom CVL. There may be better options for your needs.
Get familiar with the custom CVL implementation guide. It provides a perspective on implementing custom CVLs and what you need to consider to be successful. Its aim is to help non-technical readers to understand the concepts and when you should and should not implement custom CVLs.
Custom CVLs must not be added to mandatory fields. If the custom CVL extension fails, any mandatory fields relying on the extension will remain empty, and the user won't be able to create the entity.
This approach must not be used and is not supported.
Always use an internal cache with custom CVLs. This way, the CVLs do not fetch all values every time they load, which improves performance.
Contact inriver for guidance.
Learn more about custom CVLs in the Custom CVL implemenation guide
The custom CVL extension name must exactly match the CVL ID in the data model for them to be associated. If the names do not exactly match, then the Custom CVL will not be associated with the CVL in the model.
Creating custom CVLs
How to build a custom CVL extension
For information on how to built a custom CVL extension see How to build a custom CVL extension.
Do not allow the Custom CVL extension to throw an uncaught exception. This will cause critical errors in the user interface.
Using a different approach in a design is not supported.
How to set up a custom CVL in Control Center
During the CVL creation process in Control Center you have the option of checking the CVL property Custom Value List. If checked, this tells the system that it should look for an extension that is managing the CVL values.
Custom CVL value keys need to be updated manually
When you modify the keys of a custom CVL and then deploy or replace it in Control Center, there may be a discrepancy between the key values stored in the Fields of your Entities and the new ones in your custom CVL.
When you modify the keys used in a custom CVL key/value dictionary and then upload the custom CVL to inriver through Control Center, you must update previously stored keys. The update can be done manually through one of the inriver APIs.
Example
An example of how to update a custom CVL key or any CVL that is in an environment's model.
using System; using System.Security.Authentication; using inRiver.Remoting; namespace ServiceCenterExamples { class Program { static void Main(string[] args) { var manager = CreateManager("myUsername", "myPassword", "myEnvironment"); var cvlValue = manager.ModelService.GetCVLValueByKey("OldKey", "MyCustomCvl"); if (cvlValue==null) { return; } cvlValue.Key = "NewKey"; manager.ModelService.UpdateCVLValue(cvlValue); Console.WriteLine("Finished"); } private static IinRiverManager CreateManager(string username, string password, string environment) { try { return RemoteManager.CreateInstance("https://remoting.productmarketingcloud.com", username, password, environment); } catch (AuthenticationException e) { Console.WriteLine($"Not Authorized! \n {e.InnerException}"); throw; } catch (Exception exception) { Console.WriteLine(exception.InnerException?.ToString()); throw; } } } }
Comments
0 comments
Please sign in to leave a comment.