ValueGenerator Class |
Namespace: Omada.OE.Solution.OIM.Assembly
public class ValueGenerator
The ValueGenerator type exposes the following members.
Name | Description | |
---|---|---|
![]() | ValueGenerator |
Name | Description | |
---|---|---|
![]() | GenerateUniqueValue |
Generates unique value.
This is a generic CM and supports many parameters provided via the XML configuration object.
Please use the "Value Generator Example" as a reference.
Creating expressions:
Expression is a C# snippet, which should return a text value; or in case of conditions - boolean.
To resolve expressions, Dynamic Expresso library is used.
You can use variables in similar way to what you can do inside mail templates.
Below list of supported placeholders:
- [PROPSYSNAME] – property
- [REFPATH:/REFPROPSYSNAME:[PROPSYSNAME]] – reference path
- [CUSTSETTING: CUSTOMERSETTINGSYSNAME] – customer setting
- ##SEQUENCE_NUMBER## - number of "try". It is increased by one when last generated value is not unique. It starts from 1.
Additionally:
- there is a function RandomText.Generate available, which allows to create random strings.
* Parameters: min length, max length and string with possible characters or ranges, e.g. "A-Za-z0-9".
For example: RandomText.Generate(3, 5, "ABCD")
- Reference paths supports attribute values in the format: /path1/ATTRIBVALUES:[ATTRIBUTENAME] for getting attribute value as text. For reference properties stored in the attribute: /path1/ATTRIBVALUES:[ATTRIBUTENAME]{DOT_SYS_NAME}:[PROP_SYS_NAME] or /path1/ATTRIBVALUES:[ATTRIBUTENAME]{DOT_SYS_NAME}/path2:[PROP_SYS_NAME].
* Only one ATTRIBVALUES occurence is currently supported
* path1 is optional, we can start from the object which contains ATTRIBVALUES
Samples :
- string.Format("{0}.{1}{2}", [FIRSTNAME], [LASTNAME], ##SEQUENCE_NUMBER## == 1 ? "" : ##SEQUENCE_NUMBER##.ToString())
- string.Format("{0}{1}_{2}@domain.com", [LASTNAME], ##SEQUENCE_NUMBER## == 1 ? "" : (##SEQUENCE_NUMBER## - 1).ToString(), [FIRSTNAME].Length > 3 ? [FIRSTNAME].Substring(0, 3) : [FIRSTNAME])
- string.Format("{0}{1}.{2}@domain.com", [LASTNAME], ##SEQUENCE_NUMBER##, [REFPATH:/OUREF:[NAME]])
Warning for XML: please remember about escaping characters. You may have many in your expression. We recommend using escaping tools before you add it to XML.
|
Name | Description | |
---|---|---|
![]() | ToBool |
Converts object to boolean.
(Defined by ObjectExtensions.) |
![]() | ToDateTime |
Converts object to DateTime.
(Defined by ObjectExtensions.) |
![]() | ToInt |
Converts object to integer.
(Defined by ObjectExtensions.) |