Click or drag to resize

Main Class

Summary description for Main.
Inheritance Hierarchy
SystemObject
  Omada.OE.UtilityCodeAssemblyMain

Namespace:  Omada.OE.UtilityCodeAssembly
Assembly:  Omada.OE.UtilityCodeAssembly (in Omada.OE.UtilityCodeAssembly.dll) Version: 15.0.0.0
Syntax
C#
public class Main

The Main type exposes the following members.

Constructors
  NameDescription
Public methodMain
Top
Methods
  NameDescription
Public methodAddUsersToUserGroups
Adds several users from a reference property to some user groups in another reference property, and if removeOldUsers = true, then it will remove the existing users first.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodAddUserToUserGroups
Makes a user a member of several user groups.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodAssignRefPropertyFromValueProperty
CM uses values or list of values (comma or semicolon separated) and searches for data objects. If searchPropSysName is provided, it looks for data objects where action object valuePropSysName = searchPropSysName. Otherwise, CM checks if values are correct UIds. If yes, it does search using object UIds. Otherwise search is done by display names. If the target property is MultiValue, it adds new objects or replaces them, using value in clearExisting parameter.
Public methodAssignSetPropertyValueToReferredObjects
Assigns the specified set property value to a set property on the data object that is being referenced.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodAvoidDuplicates
The method should check that the value of the field "fldToCheckPropSysName" on the target does not equal to any of the values of the same property in objects of the type "masterDOTGuidStr", If "masterDOTComparisonFilterSetPropSysName" is configured, code method checks only for masterDOT data objects where set property "masterDOTComparisonFilterSetPropSysName" is equal to any of the values in "masterDOTComparisonFilterCommaSeparatedSetPropValuesGuidsStr"; If shouldCheckBlackList is set to true, then code method should also check that the value of the field "fldToCheckPropSysName" on the target does not equal to any of the values in any Blacklist entry of the type "blackListDOTGuidStr" with set property "blackListDOTComparisonFilterSetPropSysName" with values "blackListDOTComparisonFilterCommaSeparatedSetPropValuesGuidsStr". If equal, transaction should stop and display error message with text defined in "errorMessageText"
Codemethod usage
Designed to be used in a process only No
Action Object (data object type) Computer (Identity)
Security Overridden
Public methodCompleteActivity

The codemethod is intended to be used in request processes, where the flow is routed back to the requesting user at some point for some kind of confirmation. However, if the requesting user doesn't complete their activity within a certain time frame, the flow should continue automatically: the codemethod handles this scenario. The codemethod reassigns a certain activity instance to the identity user (typically the system user) and completes/activates a certain outgoing transition. and completes/activates a certain outgoing transition.

Action object must be an activity instance.

The activity must be active. The activity must have an outgoing transition with the specified transitionIndex. The transitions are ordered alphabetically by their English name.

The method routes the process by activating the transition and it does this by reassigning the activity to the identity user.

To use this code method, you can do the following (as an example):

- Create a system timer event

- Event must trigger on activities

- The event filter should filter on a specific process template

- The state filter should be "Active"

- A filter expression should state that: active time <= x days

Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodCompleteActivityAsCurrentAssignee

The method completes the activity as the current assignee:

if the activity is assigned to a group, a member within the group is assigned to the activity.

The activity is completed even if the assignee rejects the activity.

Important Note: This codemethod does not allow you to approve activities within the same process!

Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodCopyAssigneeToRefProperty

An activity from the process is used as the action object.

The method copies the activity's assignees to a reference property on the target object.

Used for a process event.

Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodCopyDataToReferredObjects
Method is used to copy data to a (master) data object from the action data object. The master data object is referred through a reference property on the action data object.
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
Public methodCopyPropertyValueFromActiveUser Obsolete.

Obsolete! Use CopyPropertyValuesFromActiveUser instead!

The method will set the value of a property on the action object based on the value of the same property on the active user object.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodCopyPropertyValueFromReferredObject
Example: An incident object has a reference to a CI object. A CI category is specified for the CI object. The method can copy this CI category to the incident object.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type):Action Object
Public methodCopyPropertyValuesFromActiveUser
Copies property values from the active user to the action object. The method will set the value of the properties with the specified ids on the action object, based on the value of the same properties on the active user object.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodCopyPropertyValuesFromReferencePath
Method is using "ReferencePath" concept to load a data object and then to copy the value of a property from this one to the target object.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodCopyPropertyValuesFromReferredObject
Copies property values from DataObject referred in reference property to the same properties in the ActionObject.
Codemethod usage
Designed to be used in a process only (Yes/No):No
Action Object (data object type):ActionObject
Public methodCopyPropertyValuesFromReferredObject2
Copies property values from DataObject referred in reference property to the properties in the ActionObject. From and To properties are copied based on the order of the properties in srcPropertySysNames and destPropertySysNames. Eg. srcPropertySysNames = 'Property1,Property2' destPropertySysNames = 'Property2,Property1' Will copy From referenceObject.Property1 To ActionObject.Property2 From referenceObject.Property2 To ActionObject.Property1
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodCopyPropertyValuesToReferencePath
Method copies property values from action object to object referred via ReferencePath.
Public methodCopyPropertyValuesToReferredObject
Copies values for the supplied property system name on the action object to the data object referred to through the property specified in referencePropertyId.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodCopyPropertyValuesToReferredObjects
Copies values for the supplied property system name on the action object to the data object referred to through the property specified in referencePropertyId.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodCopyPropertyValuesToReferredObjects2
Copies values for the supplied property system name on the action object to the data object referred to through the property specified in referencePropertyId.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodCopySourcePropertyToTargetProperty
Copies the value of source property to the target property Both properties are on the same data object It only works when: - copying from one value property to another value property - copying from one reference property to another reference property
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
Public methodCreateDataObjectFromTemplate

Method creates a new data object of the specified type.

The properties of the specified template object will be copied from the action object to the new data object,

based on the settings of the specified copy rule.

The method is used in master data management scenarios: when a "new object" process is completed,

a new master object needs to be created based on the values of the "change request" object that

was used in the process.

The update events triggered on the new data object type are executed on the created data object.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodCreateDataObjectFromTemplate2

Method creates a new data object of the specified type.

The properties of the specified template object will be copied from the data object with id templateObjectId,

based on the settings of the specified copy rule. If the templateDataObjectId = 0, the template data object will

be the target object.

The update events triggered on the new data object type are executed on the created data object.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)DataObjectType
Public methodCreateDataObjectFromTemplateEx

Method creates a new data object of the specified type.

The properties of the specified template object will be copied from the data object with id templateObjectId,

based on the settings of the specified copy rule. If the templateDataObjectId = 0, the template data object will

be the target object.

The update events triggered on the new data object type are executed on the created data object.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)DataObjectType
Public methodCreateProcessInstance

Used to create a process instance based on a timer.

If the process template is an edit process, then the action object is used as the target in the new process.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Process
Public methodCreateUserFromTemplate

Method creates a new user.

The properties of the specified template object will be copied from the action object to the new user,

based on the settings of the specified copy rule.

A property id must be provided containing the username on the action object.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodDeleteObject
Delete marks the DataObject in context. The object will be purged, if parameter purge is true.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodDerriveConcatenatedCategory

Calculates and assigns a new value for a set property. The new value is calculated on the basis of the chosen values in 2 other set properties. The action object must contain all 3 set properties.

For example,

setPropertyValue1Id specifies the value "02. Medium"

setPropertyValue2Id specifies the value "04. Critical"

keyLength is 2

The method tries to find a value for the derrivedSetPropertyId property that begins with "0204".

Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Action Object
Public methodFormatTemplateText
Returns a formatted text for the action object based on a template.
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
Public methodGenerateGUID
Generates a UId.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)[none]
Public methodGenerateIdentifier
Generates an identifier (for roles etc.) based on a sequence and a prefix.
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
Public methodGenerateRandomNumber
Generates a random number between the specified minimum and maximum values.
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodGenerateRandomPassword
Generate random 8 char password such as "de5h4sdf".
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodGetActiveUserInfo

Gets the active user's info.

The code method returns the active user's first name, last name, username, and email.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)N/A
Public methodGetDataObjectChangeDescription Obsolete.

Method returns a text description of the differences between the first version of a

data object and its current version.

More precisely, the current value of each of the object's properties is compared to

the first non-default value that was assigned to the object.

The method is used in (SAP) master data management scenarios.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)[Any]
Public methodGetDataObjectDifferenceDescription
Returns description of the difference between two data objects.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)[Any]
Public methodGetDataObjectDifferenceDescription2

Method returns a text description of the differences between two data objects.

The two data objects are not necessarily of the same data object types.

The method is used in master data management scenarios.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodGetReferredUserInfo

Gets the information from the user who is being referred to.

The code method returns information (first name, last name, username, and email) from the user being referenced.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any data object type that has a reference to a user
Public methodIsDateReached
Will check if the specified date is reached
Public methodMaintainUserGroupFromReferenceProperty

Method maintains the members of a user group. The members of the group are found by inspecting all the users in the system. Each user must reference another user through a reference property (typically a manager). After execution, the user group will have all the selected users (managers) as members.

The method is designed to run on a timer event.

Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodMoveActionObjectToFolder
Sets the parent of the action object to the specified newFolderId data object.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodMoveHelpdeskObjectToCustomerFolder Obsolete.
The method moves the action object to the active user’s company folder. Used by Omada Helpdesk.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodPopulateReferringObjectsForReferredObject
We have the following scenario: the action object referres an object X trough the property masterObjRefPropertyId. The objects Y1,Y2,Y3 of type referringObjTypeId are referring the object X trough a property referredTroughRefPropId. The object Y1,Y2,Y3 have a set property filterSetPropertyId set to one of the values in filterSetPropertyValueIds. The method will populate Y1,Y2,Y3 into the property referringObjRefPropertyId on the action object.
Codemethod usage
Designed to be used in a process only No
Action Object (data object type) Any
SecurityOverridden
Public methodRemoveAllInactiveUserGroupMemberships
Removes all usergroup memberships from inactive users. Designed to run on a timer.
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
Public methodRemoveReferenceFromReferringObjects
The Code method finds all the dataobjects that refers the object in the property  referredPropertySysName through the properties listed in referringPropertySysNames.  It removes the reference to the object from these properties. 
Codemethod usageDescription
Designed to be used in a process only (Yes/No)No
Action Object (data object type)Any
    
Public methodResetActivityAssignee
Reassign an activity (instance) to the initial assignee. Should be used on a transition event.
Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodResetUserPassword
Resets the password for a user with a random generated string and notifies the user.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)User
Public methodRouteProcessOnDeadline
Method is used on a timer event to check whether certain activities in processes of a certain type are completed within deadline. If not, they will be autocompleted, and the process will be routed to the given transition.
Codemethod usageTo be used in a timer event definition
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodSaveDataObjCSV
Method is used to save a CSV file generated from a view in the Omada temp folder.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodSaveDataObjCSVExtended
Method is used to save a CSV file generated from a view.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)DataObjectType
Public methodSendMailToRefferedGroup
Sends a mail to all the users of a group specified in the reference property.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)
Public methodSetAssigneeFromTargetPropertyValue

Method is to be used in a process-event-action (either timer-activated or transition-activated).

The method updates the assignee on the action object (which must be an activity).

The new assignee is found by looking in the selected value of a set property used on the process' target object.

The assignee must be stated (as a user group name) in the set property value description.

Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodSetAssigneeToActiveUsersManager Obsolete.

The method updates the assignee on the action object (which must be an activity)

The method can be used in a process event action (activated by either timer or transition).

The method updates the assignee on the action object (which must be an activity) to

the active user’s manager. The active user’s manager must be referenced in a reference property

on the user object in a property where the system name = managerPropertySysName.

The method is suitable for purchasing processes, etc., where the user’s manager must approve a purchase.

Codemethod usage
Designed to be used in a process only (Yes/No)Yes
Action Object (data object type)Activity
Public methodSetTargetPropertyValue
Sets the Set Property value. If action object is process or activity, it updates target object. If action object is other DOT, it updates action object.
Public methodSleep
The CodeMethod will suspend execution for a number of milliseconds.
Public methodSynchronizeTwoWayReference
Method will synchronize the values of a two-way reference on a single ActionObject. Example: in an ITIL scenario we operate with incidents and problems between which there is a relation. To model the scenario in OE we have two dataobjecttypes - one for incidents and one for problems. OE doesn't support two-way relations so to accomodate we create two reference properties called "related problems" (placed on the incident type) and "related incidents" (placed on the problem type). To ensure that they are synchronized this method is called whenever either an incident or a problem is created or updated.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodSynchronizeTwoWayReferenceFull
Method will synchronize the values of a two-way reference between two data object types. For all objects of the two dataobjectypes. Example: in an ITIL scenario we operate with incidents and problems between which there is a relation. To model the scenario in OE we have two dataobjecttypes - one for incidents and one for problems. OE doesn't support two-way relations so to accomodate we create two reference properties called "related problems" (placed on the incident type) and "related incidents" (placed on the problem type). To ensure that they are synchronized this method is called whenever either an incident or a problem is created or updated.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)ActionObject
Public methodTerminateProcess
The code method terminates the process.
Codemethod usage
Designed to be used in a process only (Yes/No)No. This CodeMethod does not work in a process / on a Transition Event.
Action Object (data object type)Process or Activity
Public methodTerminateProcessByReferencePath
The code method terminates the processes referenced indirectly via the Action object. The reference is described with a ReferencePath string. The object referenced by the reference path can be an activity object, a process object or a target object. In either case, the process related to the referenced object will be terminated.
Codemethod usage
Designed to be used in a process only (Yes/No)No.
Action Object (data object type)any
Public methodTestGetDataObjectsAVP
Public methodThrowError
Codemethod usage
Designed to be used in a process only (Yes/No)
Action Object (data object type)
Public methodUpdateProcessSearchData
The method will update the search data of one or more processes and their activities. If the action object is a process this process will be updated, otherwise all processes which have the target object as a target will be updated.
Codemethod usage
Designed to be used in a process onlyNo
Action Object (data object type)Process or object that is a target of a process
SecurityOverridden
Public methodUploadFile
Uploads the file from the specifed filePath on the server to the specfied file object.
Codemethod usage
Designed to be used in a process only (Yes/No)No
Action Object (data object type)[none]
Top
Extension Methods
  NameDescription
Public Extension MethodToBool
Converts object to boolean.
(Defined by ObjectExtensions.)
Public Extension MethodToDateTime
Converts object to DateTime.
(Defined by ObjectExtensions.)
Public Extension MethodToInt
Converts object to integer.
(Defined by ObjectExtensions.)
Top
See Also