You can use the Object Type Manager API to programmatically create custom object types for use in your applications. It includes the following features:
Additionally, the following APIs provide functionality for working with event handlers, object rules, and mass operations for object types:
As a sample use case, you could use the Object Type Manager service to add new object types to support a custom application that you developed. You might want to implement an application that tracks vendor or customer information and decide to add different object types for each of these items. These object types could be further customized with object rules, event handlers, and mass operations.
You can also use the Object Type Manager and other related services through the REST API. For more information, see Object Type Manager (REST).
This page contains the following information:
Click the following drop-down links to learn about the methods and classes used by the Object Type Manager and related APIs.
The Object Type Manager API contains the following methods and classes.
The Object Type Manager API exposes the following methods on the IObjectTypeManager interface in the Relativity.Services.Interfaces.ObjectType namespace:
Note: The ObjectTypeIdentifier class contains the Artifact ID, Name, and other identifiers for an object. It is available in the Relativity.Services.Interfaces.Shared.Models namespace. For more information, see this class in the Services API.
ReadAsync() method - retrieves information about an object, including its parent object type, whether it is a dynamic object or its view is enabled, and other properties. You can also use this overloaded method to return extended metadata, including information about the operations that you have permissions to perform on the object, such as update or delete. This method takes the Artifact IDs of the workspace and object type, and two optional Boolean values for extended metadata. It returns an ObjectTypeResponse object. See Read an object type for C# code sample, and Read an object type in REST for brief field descriptions.
The Object Type Manager API includes the following classes available in the Relativity.Services.Interfaces.ObjectType.Models namespace:
Additionally, this API includes the following class in the Relativity.Services.Interfaces.ObjectType namespace:
The Event Handler Manager API contains the following methods and classes.
The Event Handler Manager API exposes the following methods on the IEventHandlerManager interface in the Relativity.Services.Interfaces.EventHandler namespace:
The Event Handler Manager API includes the following classes and enumeration available in the Relativity.Services.Interfaces.EventHandler.Models namespace:
The Object Rule Manager API contains the following methods and classes.
The Object Rule Manager API exposes the following methods on the IObjectRuleManager interface in the Relativity.Services.Interfaces.ObjectRules namespace:
Create method for each object rule type - adds a new object rule to the specified object type. The parameters for the create methods include the Artifact ID of the workspace, and a request object for the rule type. These methods return the Artifact ID of the new object rule.
Note: Each type of object rule has its own create method, and request class. For a complete list of create methods, see Create an object rule.
Note: The SubListObjectIdentifier class contains the Artifact ID, Name, ListType, and other identifiers for an object. It is available in the Relativity.Services.Interfaces.Shared.Models namespace. For more information, see this class in the Services API.
Note: The DisplayableObjectIdentifier class contains the Artifact ID, Guids, and Name properties. It is available in the Relativity.Services.Interfaces.Shared.Models namespace. For more information, see this class in the Services API.
Note: Each type of object rule has its own update method, and request class. For a complete list of update methods, see Update an object rule.
The Object Rule Manager API includes the following classes and enumeration available in the Relativity.Services.Interfaces.ObjectRules.Models namespace:
Additionally, this API includes the following class in the Relativity.Services.Interfaces.ObjectType namespace:
The Mass Operation Manager API contains the following methods and classes.
The Mass Operation Manager API exposes the following methods on the IMassOperationManager interface in the Relativity.Services.Interfaces.MassOperation namespace:
Note: The ObjectTypeIdentifier class contains the Artifact ID, Name, and other identifiers for an object. It is available in the Relativity.Services.Interfaces.Shared.Models namespace. For more information, see this class in the Services API.
The Mass Operation Manager API includes the following classes and enumeration available in the Relativity.Services.Interfaces.ObjectRules.Models namespace:
Additionally, this API includes the following class in the Relativity.Services.Interfaces.MassOperation namespace:
The Object Type Manager API supports create, read, update, and delete operations on object types. It also includes helper methods used to retrieve information about parent object types, and dependent objects.
Review the following guidelines for working with this service:
See the following subsections for more information:
Use the CreateAsync() method to add a new object type to a workspace or the admin-level context. When you call this method, pass the Artifact ID of the workspace or -1 for admin-level context, and an ObjectTypeRequest object.
To set the Artifact ID for the ParentObjectType on the ObjectTypeRequest object, use the GetAvailableParentObjectTypesAsync() method. For more information, see Retrieve a parent object types.
public static async Task Create_Async() { int workspaceId = 1018486; int parentArtifactTypeId = 10; int parentArtifactId = 1035231; int applicationId = 1035699; ObjectTypeRequest request = new ObjectTypeRequest { Name = "Test Object", CopyInstancesOnCaseCreation = false, CopyInstancesOnParentCopy = false, EnableSnapshotAuditingOnDelete = true, PersistentListsEnabled = false, PivotEnabled = true, SamplingEnabled = false, Keywords = "", Notes = "", ParentObjectType = new Securable<ObjectTypeIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = parentArtifactId, ArtifactTypeID = parentArtifactTypeId } }, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { int newObjectTypeArtifactId = await objectTypeManager.CreateAsync(workspaceId, request); string info = string.Format("Created object type with Artifact ID {0}", newObjectTypeArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can retrieve basic information about an object type or extended information, which also includes operations that you have permissions to perform on the object type. If you want to return extended information, use the overloaded method by passing Boolean values set to true for additional metadata and permissions as follows:
ObjectTypeResponse response = await objectTypeManager.ReadAsync(workspaceId, objectTypeArtifactId, true, true);
The following code sample illustrates how to call the ReadAsync() method by passing the Artifact ID of a workspace and an object type. It returns only basic information. For a list of basic and extended properties, see Read an object type in Object Type Manager (REST).
public static async Task Read_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { ObjectTypeResponse response = await objectTypeManager.ReadAsync(workspaceId, objectTypeArtifactId); string info = string.Format("Read object type {0} with Artifact ID {1}", response.Name, response.ArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
Use the UpdateAsync() method to modify the properties of an object type. The following code sample illustrates how to call this method by passing the Artifact ID of a workspace and an object type, and an ObjectTypeRequest object to it.
Additionally, you can also restrict the update of an object type to the date that it was last modified by passing the value of LastModifiedOn property as an argument to the overloaded UpdateAsync() method. You can get the value of this property from an ObjectTypeResponse object, which is returned by the ReadAsync() method.
public static async Task Update_Async() { int workspaceId = 1018486; int parentArtifactTypeId = 10; int parentArtifactId = 1035231; int applicationId = 1035699; int objectTypeArtifactId = 1035231; ObjectTypeRequest request = new ObjectTypeRequest { Name = "Test Object Update", CopyInstancesOnCaseCreation = false, CopyInstancesOnParentCopy = false, EnableSnapshotAuditingOnDelete = true, PersistentListsEnabled = false, PivotEnabled = true, SamplingEnabled = false, Keywords = "updated keywords", Notes = "updated notes", ParentObjectType = new Securable<ObjectTypeIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = parentArtifactId, ArtifactTypeID = parentArtifactTypeId } }, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { await objectTypeManager.UpdateAsync(workspaceId, objectTypeArtifactId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
Before you delete an object type, you may want to call the GetDependencyList() method to retrieve a list of dependent objects. For more information, see the following pages:
The following code sample illustrates how to call the DeleteAsync() method by passing Artifact IDs of a workspace and an object type.
public static async Task Delete_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { await objectTypeManager.DeleteAsync(workspaceId, objectTypeArtifactId); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
Use the GetAvailableParentObjectTypesAsync() method to retrieve a list of parent object types. You may want to call this method before creating a new object type, because you must specify its parent object type.
public static async Task GetAvailableParentObjectTypes_Async() { int workspaceId = 1018486; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { List<ObjectTypeIdentifier> response = await objectTypeManager.GetAvailableParentObjectTypesAsync(workspaceId); foreach (ObjectTypeIdentifier objectType in response) { string info = string.Format("Read objectType {0} with Artifact ID {1}", objectType.Name, objectType.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can retrieve a list of objects in a workspace that are dependent on a specific object type. The GetDependencyList() method returns a list of Dependency instances, which include information about the relationship between object type that you specified, and the dependent object.
The following sample code illustrates how to call the GetDependencyList() method by passing the Artifact IDs of a workspace and an object type.
public static async Task GetDependencyList(int objectTypeID) { int workspaceId = 1018486; using (Services.Interfaces.ObjectType.IObjectTypeManager objectTypeManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectType.IObjectTypeManager>()) { try { List<Dependency> response = await objectTypeManager.GetDependencyList(workspaceID, objectTypeID); foreach (Dependency dependency in response) { string info = string.Format("Object type {0} has a connection type {1} with {2} object(s).", dependency.ObjectType, dependency.Connection, dependency.Count); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can add custom behavior to an object type by attaching event handlers to it. For example, you might attach an event handler that performs a specific action when a user makes an update to an object and then attempts to save it. For more information, see Develop object type event handlers.
The Event Handler Manager service contains methods for programmatically attaching event handlers to an object type, and for detaching them. It also provides helper methods that you can use for the following purposes:
See the following subsections for more information:
To attach an event handler to an object type, call the AttachAsync() method by passing the Artifact IDs of a workspace and an object type, and the ID of the event handler.
Note: In the following code sample, the eventHandlerId parameter is an identifier assigned by Relativity to the event handler. This identifier isn't the artifact ID for the event handler. The GetAttachedAsync() and GetAvailableEventHandlersAsync() methods return an EventHandlerResponse object, which has this ID property. For more information, see EventHandlerResponse class in the Services API.
public static async Task Attach_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; int eventHandlerId = 1982384; using (Services.Interfaces.EventHandler.IEventHandlerManager eventHandlerManager = serviceFactory.CreateProxy<Services.Interfaces.EventHandler.IEventHandlerManager>()) { try { await eventHandlerManager.AttachAsync(workspaceId, objectTypeArtifactId, eventHandlerId); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
To detach an event handler from an object type, call the DetachAsync() method by passing the Artifact IDs of a workspace and an object type, and the ID of the event handler.
Note: In the following code sample, the eventHandlerId parameter is an identifier assigned by Relativity to the event handler. This identifier isn't the Artifact ID for the event handler. The GetAttachedAsync() and GetAvailableEventHandlersAsync() methods return an EventHandlerResponse object, which has this ID property. For more information, see EventHandlerResponse class in the Services API.
public static async Task Detach_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; int eventHandlerId = 1982384; using (Services.Interfaces.EventHandler.IEventHandlerManager eventHandlerManager = serviceFactory.CreateProxy<Services.Interfaces.EventHandler.IEventHandlerManager>()) { try { await eventHandlerManager.DetachAsync(workspaceId, objectTypeArtifactId, eventHandlerId); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
To retrieve the event handlers attached to an object type, call the GetAttachedAsync() method by passing the Artifact IDs of a workspace and an object type. If no event handlers are available for the object type, this method returns an empty list.
public static async Task GetAttached_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; using (Services.Interfaces.EventHandler.IEventHandlerManager eventHandlerManager = serviceFactory.CreateProxy<Services.Interfaces.EventHandler.IEventHandlerManager>()) { try { List<EventHandlerResponse> response = await eventHandlerManager.GetAttachedAsync(workspaceId, objectTypeArtifactId); foreach (EventHandlerResponse eventHandler in response) { string info = string.Format("Read Event Handler {0} with Artifact ID {1}", eventHandler.ClassName, eventHandler.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can retrieve a list of event handlers in a workspace that are compatible with a specific object type.
The following code sample illustrates how to call the GetAvailableEventHandlersAsync() method by passing the Artifact IDs of a workspace and an object type. If no event handlers are available for the object type, this method returns an empty list.
public static async Task GetAvailableEventHandlers_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1035231; using (Services.Interfaces.EventHandler.IEventHandlerManager eventHandlerManager = serviceFactory.CreateProxy<Services.Interfaces.EventHandler.IEventHandlerManager>()) { try { List<EventHandlerResponse> response = await eventHandlerManager.GetAvailableEventHandlersAsync(workspaceId, objectTypeArtifactId); foreach (EventHandlerResponse eventHandler in response) { string info = string.Format("Read Event Handler {0} with Artifact ID {1}", eventHandler.ClassName, eventHandler.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can use object rules to further customize the behavior of the object types that you create. The Object Rule Manager service simplifies this process by supporting CRUD operations on object rules. It also provides helper methods for retrieving information about associative objects, layouts, choices and choice fields used when creating or updating an object rule. For a complete list of object rules, see Guidelines for the Object Rule Manager API.
See the following subsections for more information:
Review the following guidelines for the Object Rule Manager service:
Create or update this object rule | Use these helper methods | Compares to this UI field |
---|---|---|
Choice field methods | Field | |
Layout methods | Action | |
Choice field methods | Field | |
Choice method | Value | |
Layout methods | Action | |
Choice field methods | Field | |
Choice method | Value | |
Associated object methods | Associative/Child Object |
You can create object rules by using the methods available on the IObjectRuleManager interface. For general information about object rules, see Adding an object rule.
Click the following drop-down links to view sample code for sub-list visibility, choices, and layouts rules. For more information about create methods, see the IObjectRuleManager interface in the Relativity.Services.Interfaces.ObjectRules namespace of the Services API.
Task<int> CreateChoiceBehaviorAsync(int workspaceID, ChoiceBehaviorRuleRequest objectRuleRequest)
Task<int> CreateCustomSingleObjectAddLinkVisibilityAsync(int workspaceID, CustomSingleObjectAddLinkVisibilityRuleRequest objectRuleRequest)
Task<int> CreateDefaultLayoutAsync(int workspaceID, DefaultLayoutRuleRequest objectRuleRequest)
Task<int> CreateDefaultLayoutOnNewAsync(int workspaceID, DefaultLayoutOnNewRuleRequest objectRuleRequest)
Task<int> CreateGlobalButtonVisibilityAsync(int workspaceID, GlobalButtonVisibilityRuleRequest objectRuleRequest)
Task<int> CreateMassActionVisibilityAsync(int workspaceID, MassActionVisibilityRuleRequest objectRuleRequest)
Task<int> CreateNewButtonOverrideAsync(int workspaceID, NewButtonOverrideRuleRequest objectRuleRequest);
Task<int> CreateSubListButtonVisibilityAsync(int workspaceID, SubListButtonVisibilityRuleRequest objectRuleRequest)
Task<int> CreateOverrideEditLinkAsync(int workspaceID, OverrideEditLinkRuleRequest objectRuleRequest)
Task<int> CreateOverrideViewLinkAsync(int workspaceID, OverrideViewLinkRuleRequest objectRuleRequest)
The following code sample illustrates how to instantiate a SubListButtonVisibilityRuleRequest object with properties specified for the new object rule. To create the rule, call the CreateSubListButtonVisibilityAsync() method by passing the Artifact ID of workspace where you want to add the rule, and the SubListButtonVisibilityRuleRequest instance.
public static async Task CreateSublistButtonVisibilityRule_Async() { int workspaceId = 1018486; int parentArtifactId = 101456834 int fieldId = 1035231; int choiceId = 1938203; int sublistObjectId = 1832739; int applicationId = 1035699; SubListButtonVisibilityRuleRequest request = new SubListButtonVisibilityRuleRequest { Name = "Test Object Rule Request", ShowNew = false, ShowDelete = false, ShowLink = false, ShowUnlink = true, ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, Choice = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = choiceId } }, SubListObject = new Securable<ObjectTypeIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = sublistObjectId } }, RelativityApplications = new List<ObjectIdentifier> { new ObjectIdentifier { ArtifactID = applicationId } } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { int newRuleArtifactId = await objectRuleManager.CreateSubListButtonVisibilityAsync(workspaceId, request); string info = string.Format("Created object rule with Artifact ID {0}", newRuleArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
The following code sample illustrates how to instantiate a ChoiceBehaviorRuleRequest object with properties specified for the new object rule. To create the rule, call the CreateChoiceBehaviorAsync() method by passing the Artifact ID of workspace where you want to add the rule, and the ChoiceBehaviorRuleRequest instance.
public static async Task CreateChoiceBehavior_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int fieldId = 1035231; int applicationId = 1035699; ChoiceBehaviorRuleRequest request = new ChoiceBehaviorRuleRequest { Name = "Test Choice Behavior Rule", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, ShowAdd = true, ShowDelete = false, ShowRename = false, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { int newRuleArtifactId = await objectRuleManager.CreateChoiceBehaviorAsync(workspaceId, request); string info = string.Format("Created object rule with Artifact ID {0}", newRuleArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
The following code sample illustrates how to instantiate a DefaultLayoutRuleRequest object with properties specified for the new object rule. To create the rule, call the CreateDefaultLayoutAsync() method by passing the Artifact ID of workspace where you want to add the rule, and the DefaultLayoutRuleRequest instance.
public static async Task CreateDefaultLayout_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int fieldId = 1035231; int choiceId = 1938203; int layoutId = 1837293; int applicationId = 1035699; DefaultLayoutRuleRequest request = new DefaultLayoutRuleRequest { Name = "Test Object Rule Request", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, AllowLayoutChange = true, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, Choice = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = choiceId } }, Layout = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = layoutId } }, RelativityApplications = new List<ObjectIdentifier> { new ObjectIdentifier { ArtifactID = applicationId } } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { int newRuleArtifactId = await objectRuleManager.CreateDefaultLayoutAsync(workspaceId, request); string info = string.Format("Created object rule with Artifact ID {0}", newRuleArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can retrieve basic information about an object rule or extended information, which also includes operations that you have permissions to perform on the object rule. If you want to return extended information, use the overloaded method by passing Boolean values set to true for additional metadata and permissions as follows:
ObjectRuleResponse response = await objectRuleManager.ReadAsync(workspaceId, objectRuleArtifactId, true, true);
The following code sample illustrates how to call the ReadAsync() method by passing only the Artifact IDs of the workspace and the object rule. Consequently, it returns only basic information. For a list of basic and extended properties, see Read an object rule in Object Type Manager (REST).
public static async Task Read_Async() { int workspaceId = 1018486; int objectRuleArtifactId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { ObjectRuleResponse response = await objectRuleManager.ReadAsync(workspaceId, objectRuleArtifactId); string info = string.Format("Read object rule {0} with Artifact ID {1}", response.Name, response.ArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can update object rules by using the methods available on the IObjectRuleManager interface. All object rules have an overloaded update method called by passing the Artifact IDs of a workspace and the object rule, the appropriate request object for the rule type, and an optional DateTime object.
Note: To get the Artifact ID of an object rule, use the ReadAsync() method on the Object Manager (.NET).
When you want to restrict the update of an object rule to the date that it was last modified, pass the value of LastModifiedOn property as an argument to one of the overloaded update methods. You can get the value of this property from an ObjectRuleResponse object, which is returned by the ReadAsync() method.
Click the following drop-down links to view sample code for sub-list visibility, choices, and layouts rules. For more information about update methods, see the IObjectRuleManager interface in the Relativity.Services.Interfaces.ObjectRules namespace of the Services API.
You can find general information about available object rules in Adding an object rule.
Task UpdateChoiceBehaviorAsync( int workspaceID, int objectRuleID, ChoiceBehaviorRuleRequest objectRuleRequest )
Task UpdateChoiceBehaviorAsync( int workspaceID, int objectRuleID, ChoiceBehaviorRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateCustomSingleObjectAddLinkVisibilityAsync( int workspaceID, int objectRuleID, CustomSingleObjectAddLinkVisibilityRuleRequest objectRuleRequest )
Task UpdateCustomSingleObjectAddLinkVisibilityAsync( int workspaceID, int objectRuleID, CustomSingleObjectAddLinkVisibilityRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateDefaultLayoutAsync( int workspaceID, int objectRuleID, DefaultLayoutRuleRequest objectRuleRequest )
Task UpdateDefaultLayoutAsync( int workspaceID, int objectRuleID, DefaultLayoutRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateDefaultLayoutOnNewAsync( int workspaceID, int objectRuleID, DefaultLayoutOnNewRuleRequest objectRuleRequest )
Task UpdateDefaultLayoutOnNewAsync( int workspaceID, int objectRuleID, DefaultLayoutOnNewRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateGlobalButtonVisibilityAsync( int workspaceID, int objectRuleID, GlobalButtonVisibilityRuleRequest objectRuleRequest )
Task UpdateGlobalButtonVisibilityAsync( int workspaceID, int objectRuleID, GlobalButtonVisibilityRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateMassActionVisibilityAsync( int workspaceID, int objectRuleID, MassActionVisibilityRuleRequest objectRuleRequest )
Task UpdateMassActionVisibilityAsync( int workspaceID, int objectRuleID, MassActionVisibilityRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateNewButtonOverrideAsync( int workspaceID, int objectRuleID, NewButtonOverrideRuleRequest objectRuleRequest )
Task UpdateNewButtonOverrideAsync( int workspaceID, int objectRuleID, NewButtonOverrideRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateSubListButtonVisibilityAsync( int workspaceID, int objectRuleID, SubListButtonVisibilityRuleRequest objectRuleRequest )
Task UpdateSubListButtonVisibilityAsync( int workspaceID, int objectRuleID, SubListButtonVisibilityRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateOverrideEditLinkAsync( int workspaceID, int objectRuleID, OverrideEditLinkRuleRequest objectRuleRequest )
Task UpdateOverrideEditLinkAsync( int workspaceID, int objectRuleID, OverrideEditLinkRuleRequest objectRuleRequest, DateTime lastModifiedOn )
Task UpdateOverrideViewLinkAsync( int workspaceID, int objectRuleID, OverrideViewLinkRuleRequest objectRuleRequest )
Task UpdateOverrideViewLinkAsync( int workspaceID, int objectRuleID, OverrideViewLinkRuleRequest objectRuleRequest, DateTime lastModifiedOn )
The following code sample illustrates how to instantiate a SubListButtonVisibilityRuleRequest object with properties used for updating the object rule. To update the rule, call the UpdateSubListButtonVisibilityAsync() method by passing Artifact IDs of the workspace and object rule, and the SubListButtonVisibilityRuleRequest instance.
public static async Task UpdateSubListButtonVisibility_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int fieldId = 1035231; int choiceId = 1938203; int layoutId = 1837293; int applicationId = 1035699; int objectRuleId = 1383730; SubListButtonVisibilityRuleRequest request = new SubListButtonVisibilityRuleRequest { Name = "Test Object Rule Request", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, AllowLayoutChange = true, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, Choice = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = choiceId } }, Layout = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = layoutId } }, RelativityApplications = new List<ObjectIdentifier> { new ObjectIdentifier { ArtifactID = applicationId } } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { await objectRuleManager.UpdateSubListButtonVisibilityAsync(workspaceId, objectRuleId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
The following code sample illustrates how to instantiate a ChoiceBehaviorRuleRequest object with properties used for updating the object rule. To update the rule, call the UpdateChoiceBehaviorAsync() method by passing Artifact IDs of the workspace and object rule, and the ChoiceBehaviorRuleRequest instance.
public static async Task UpdateChoiceBehavior_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int fieldId = 1035231; int applicationId = 1035699; int objectRuleId = 1383730; ChoiceBehaviorRuleRequest request = new ChoiceBehaviorRuleRequest { Name = "Test Choice Behavior Rule Update", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, ShowAdd = false, ShowDelete = true, ShowRename = true, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { await objectRuleManager.UpdateChoiceBehaviorAsync(workspaceId, objectRuleId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
The following code sample illustrates how to instantiate a DefaultLayoutRuleRequest object with properties used for updating the object rule. To update the rule, call the UpdateDefaultLayoutAsync method by passing Artifact IDs of the workspace and object rule, and the DefaultLayoutRuleRequest instance.
public static async Task UpdateLayoutBehavior_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int fieldId = 1035231; int choiceId = 1938203; int layoutId = 1837293; int applicationId = 1035699; int objectRuleId = 1383730; DefaultLayoutRuleRequest request = new DefaultLayoutRuleRequest { Name = "Test Object Rule Request", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId }, AllowLayoutChange = true, Field = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = fieldId } }, Choice = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = choiceId } }, Layout = new Securable<ObjectIdentifier> { Secured = false, Value = new ObjectTypeIdentifier { ArtifactID = layoutId } }, RelativityApplications = new List<ObjectIdentifier> { new ObjectIdentifier { ArtifactID = applicationId } } }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { await objectRuleManager.UpdateDefaultLayoutAsync(workspaceId, objectRuleId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can remove an object rule from an object type by calling the DeleteAsync()method, and passing Artifact IDs of a workspace and an object rule to it. See the following code sample:
public static async Task Delete_Async() { int workspaceId = 1018486; int objectRuleId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { await objectRuleManager.DeleteAsync(workspaceId, objectRuleId); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can remove multiple object rules across different object types by making a single call to the MassDeleteAsync() method. Pass the Artifact ID of the workspace and a list containing the Artifact ID for each rule that you want to delete to this method. See the following code sample:
public static async Task Delete_Async() { int workspaceId = 1018486; int objectRuleId1 = 1039509; int objectRuleId2 = 1039525; int objectRuleId3 = 1039630; List<ObjectIdentifiers> objectRulesToDelete = new List<ObjectIdentifiers> = [ objectRuleId1, objectRuleId2, objectRuleId3]; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { await objectRuleManager.MassDeleteAsync(workspaceId, objectRulesToDelete); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
When you create or update an object rule, you must provide the Artifact ID of any associative objects, layouts, choices and choice fields that it references. The Object Rule Manager service provides several helper methods that you can use to retrieve the Artifact ID, name, and other information about these objects. For most objects, it includes overloaded methods with following signatures:
For more information, see Guidelines for the Object Rule Manager API.
If you have the Artifact ID of the object type, use the following method to retrieve associated objects for it:
Task<List<SubListObjectIdentifier>> GetAvailableAssociatedObjectsAsync(int workspaceID, int objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableAssociatedObjects_Async() { int workspaceId = 1018486; int objectTypeId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<SubListObjectIdentifier> response = await objectRuleManager.GetAvailableAssociatedObjectsAsync(workspaceId, objectTypeId); foreach (SubListObjectIdentifier subListIdentifier in response) { string info = string.Format("Read {0} '{1}' with Artifact ID '{2}'", subListIdentifier.ListType, subListIdentifier.Name, subListIdentifier.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the user-friendly name of the object type, use the following method to retrieve associated objects for it:
Task<List<SubListObjectIdentifier>> GetAvailableAssociatedObjectsAsync(int workspaceID, ObjectTypeIdentifier objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableAssociatedObjects_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1039509; ObjectTypeIdentifier objectTypeIdentifier = new ObjectTypeIdentifier { ArtifactID = objectTypeArtifactId }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<SubListObjectIdentifier> response = await objectRuleManager.GetAvailableAssociatedObjectsAsync(workspaceId, objectTypeIdentifier); foreach (SubListObjectIdentifier subListIdentifier in response) { string info = string.Format("Read {0} '{1}' with Artifact ID '{2}'", subListIdentifier.ListType, subListIdentifier.Name, subListIdentifier.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the Artifact ID of the object type, use the following method to retrieve single choice fields for it:
Task<List<DisplayableObjectIdentifier>> GetAvailableSingleChoiceFieldsAsync(int workspaceID, int objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableSingleChoiceFields_Async() { int workspaceId = 1018486; int objectTypeId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableSingleChoiceFieldsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier singleChoiceField in response) { string info = string.Format("Read single choice field {0} with Artifact ID {1}", singleChoiceField.Name, singleChoiceField.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } }
If you have the user-friendly name of the object type, use the following method to retrieve single choice fields for it:
CopyTask<List<DisplayableObjectIdentifier>> GetAvailableSingleChoiceFieldsAsync(int workspaceID, ObjectTypeIdentifier objectTypeID)
The following code sample illustrates how to use this method:
{ int workspaceId = 1018486; int objectTypeArtifactId = 1039509; ObjectTypeIdentifier objectTypeId = new ObjectTypeIdentifier { ArtifactID = objectTypeArtifactId }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableSingleChoiceFieldsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier singleChoiceField in response) { string info = string.Format("Read single choice field {0} with Artifact ID {1}", singleChoiceField.Name, singleChoiceField.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the Artifact ID of the object type, use the following method to retrieve choice fields for it:
Task<List<DisplayableObjectIdentifier>> GetAvailableChoiceFieldsAsync(int workspaceID, int objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableChoiceFields_Async() { int workspaceId = 1018486; int objectTypeId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableChoiceFieldsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier choiceField in response) { string info = string.Format("Read choice field {0} with Artifact ID {1}", choiceField.Name, choiceField.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the user-friendly name of the object type, use the following method to retrieve choice fields for it:
Task<List<DisplayableObjectIdentifier>> GetAvailableChoiceFieldsAsync(int workspaceID, ObjectTypeIdentifier objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableChoiceFields_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1039509; ObjectTypeIdentifier objectTypeId = new ObjectTypeIdentifier { ArtifactID = objectTypeArtifactId }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableChoiceFieldsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier choiceField in response) { string info = string.Format("Read choice field {0} with Artifact ID {1}", choiceField.Name, choiceField.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
To retrieve a list of choices for an object type, use the following method:
Task<List<DisplayableObjectIdentifier>> GetAvailableChoicesAsync(int workspaceID, int fieldID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableChoices_Async() { int workspaceId = 1018486; int fieldId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableChoicesAsync(workspaceId, fieldId); foreach (DisplayableObjectIdentifier choice in response) { string info = string.Format("Read choice {0} with Artifact ID {1}", choice.Name, choice.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the Artifact ID of the object type, use the following method to retrieve layouts for it:
Task<List<DisplayableObjectIdentifier>> GetAvailableLayoutsAsync(int workspaceID, int objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableLayouts_Async() { int workspaceId = 1018486; int objectTypeId = 1039509; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableLayoutsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier layout in response) { string info = string.Format("Read layout {0} with Artifact ID {1}", layout.Name, layout.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
If you have the user-friendly name of the object type, use the following method to retrieve layouts for it:
Task<List<DisplayableObjectIdentifier>> GetAvailableLayoutsAsync(int workspaceID, ObjectTypeIdentifier objectTypeID)
The following code sample illustrates how to use this method:
public static async Task GetAvailableLayouts_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1039509; ObjectTypeIdentifier objectTypeId = new ObjectTypeIdentifier { ArtifactID = objectTypeArtifactId }; using (Services.Interfaces.ObjectRules.IObjectRuleManager objectRuleManager = serviceFactory.CreateProxy<Services.Interfaces.ObjectRules.IObjectRuleManager>()) { try { List<DisplayableObjectIdentifier> response = await objectRuleManager.GetAvailableLayoutsAsync(workspaceId, objectTypeId); foreach (DisplayableObjectIdentifier layout in response) { string info = string.Format("Read layout {0} with Artifact ID {1}", layout.Name, layout.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can add mass operations to object types to further customize their behavior. When a user interacts with a mass operation, you can display a custom page or execute an event handler with specialized functionality. For general information about mass operations, see Adding a custom mass operation.
The Mass Operations Manager API includes methods for creating, reading, updating, and deleting mass operations. It also includes helper methods for retrieving information about object types that be associated with a mass operation, and available event handlers and layouts for use with a mass operation.
Review the following guidelines for working with this service:
See the following subsections for more information:
You can a create a mass operation that displays a custom page or that executes a custom event handler when a user interacts with it. For general information about mass operations, see Adding a custom mass operation.
Click the following drop-down links to view sample code for custom page and event handler mass operations.
The following code sample illustrates how to instantiate a MassOperationRequest object containing properties used to create the mass operation. Next, it shows how to call the CreateAsync() method by passing the Artifact ID of the workspace and the MassOperationRequest object.
public static async Task Create_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; MassOperationRequest request = new MassOperationRequest { Name = "Test Custom Page Mass Operation", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId}, Url = "www.url.com", PopupHeight = 50, PopupWidth = 50, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { int newMassOperationArtifactId = await massOperationManager.CreateAsync(workspaceId, request); string info = string.Format("Created mass operation with Artifact ID {0}", newMassOperationArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
The following code sample illustrates how to instantiate a MassOperationRequest object containing properties used to create the mass operation. Next, it shows how to call the CreateAsync() method by passing the Artifact ID of the workspace and the MassOperationRequest object.
public static async Task Create_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; int eventHandlerId = 1937493; int layoutId = 1035699; MassOperationRequest request = new MassOperationRequest { Name = "Test Event Handler Mass Operation", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId}, EventHandlerID = eventHandlerId, Layout = new Securable<ObjectIdentifier>(new ObjectIdentifier { ArtifactID = layoutId }), RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { int newMassOperationArtifactId = await massOperationManager.CreateAsync(workspaceId, request); string info = string.Format("Created mass operation with Artifact ID {0}", newMassOperationArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can retrieve basic information about a mass operation or extended information, which also includes operations that you have permissions to perform on the mass operation. If you want to return extended information, use the overloaded method by passing Boolean values set to true for additional metadata and permissions as follows:
MassOperationResponse response = await massOperationManager.ReadAsync(workspaceId, massOperationId, true, true);
The following code sample illustrates how to call the ReadAsync() method by passing the Artifact IDs of the workspace and the mass operation. Consequently, it returns only basic information. For a list of basic and extended properties, see Read a mass operation.
public static async Task Read_Async() { int workspaceId = 1018486; int massOperationId = 1830283; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { MassOperationResponse response = await massOperationManager.ReadAsync(workspaceId, massOperationId); string info = string.Format("Read object type {0} with Artifact ID {1}", response.Name, response.ArtifactId); Console.Write(info); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can update the properties of custom page and event handler mass operations by using the overloaded UpdateAsync() method.
You can also restrict the update of a mass operation to the date that it was last modified by passing the value of LastModifiedOn property as an argument to the overloaded UpdateAsync() method. You can get the value of this property from an MassOperationResponse object, which is returned by the ReadMassOperationAsync() method.
You can use these overloaded UpdateAsync() methods to modify custom page mass operations:
Task UpdateAsync( int workspaceID, int massOperationID, CustomPageMassOperationRequest massOperationRequest )
Task UpdateAsync( int workspaceID, int massOperationID, CustomPageMassOperationRequest massOperationRequest, DateTime lastModifiedOn )
The following code sample illustrates how to instantiate a MassOperationRequest object containing the updates to the mass operation. Next, it shows how to call the UpdateAsync() method by passing the Artifact IDs of the workspace and mass operation, and the MassOperationRequest object.
public static async Task Update_Async() { int workspaceId = 1018486; int parentArtifactId = 1456834; MassOperationRequest request = new MassOperationRequest { Name = "Test Custom Page Mass Operation Updated", ObjectType = new ObjectTypeIdentifier { ArtifactID = parentArtifactId}, Url = "www.url.com", PopupHeight = 50, PopupWidth = 50, RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { await massOperationManager.UpdateAsync(workspaceId, massOperationId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can use these overloaded UpdateAsync() methods to modify event handler mass operations:
Task UpdateAsync( int workspaceID, int massOperationID, EventHandlerMassOperationRequest massOperationRequest )
Task UpdateAsync( int workspaceID, int massOperationID, EventHandlerMassOperationRequest massOperationRequest, DateTime lastModifiedOn )
The following code sample illustrates how to instantiate a MassOperationRequest object containing the updates to the mass operation. Next, it shows how to call the UpdateAsync() method by passing the Artifact IDs of the workspace and mass operation, and the MassOperationRequest object.
public static async Task Update_Async() { int workspaceId = 1018486; int objectTypeArtifactId = 1456834; int eventHandlerId = 1937493; int layoutId = 1035699; int massOperationId = 1830283; MassOperationRequest request = new MassOperationRequest { Name = "Test Event Handler Mass Operation Updated", ObjectType = new ObjectTypeIdentifier { ArtifactID = 1456385}, EventHandlerID = eventHandlerId, Layout = new Securable<ObjectIdentifier>(new ObjectIdentifier { ArtifactID = objectTypeArtifactId }), RelativityApplications = new List<Securable<ObjectIdentifier>> { new ObjectIdentifier {ArtifactID = applicationId} } }; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { await massOperationManager.UpdateAsync(workspaceId, massOperationId, request); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can remove a mass operation from object types by calling the DeleteAsync() method, and passing Artifact IDs of a workspace and a mass operation to it. See the following code sample:
public static async Task Delete_Async() { int workspaceId = 1018486; int massOperationId = 1830283; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { await massOperationManager.DeleteAsync(workspaceId, massOperationId); } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can customize object types with additional functionality by creating mass operations for them. To retrieve a list of available object types in a specific workspace, call the GetAvailableObjectTypeAsync() method.
The following code sample illustrates how to call the GetAvailableObjectTypeAsync() method by passing the Artifact ID of the workspace containing the object types to retrieve.
public static async Task GetAvailableObjectTypes_Async() { int workspaceId = 1018486; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { List<ObjectTypeIdentifier> response = await massOperationManager.GetAvailableObjectTypesAsync(workspaceId); foreach (ObjectTypeIdentifier objectType in response) { string info = string.Format("Read object type {0} with Artifact ID {1}", objectType.Name, objectType.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
You can add an event handler for a mass operation to an object type. This event handler executes when the user executes the mass operation through the Relativity UI. You can retrieve a list of available event handlers by calling the GetAvailableEventHandlersAsync() method. For general information about event handlers, see Create an object type.
The following code sample illustrates how to call the GetAvailableEventHandlersAsync() method by passing the passing the Artifact ID of the workspace containing the event handlers to retrieve.
public static async Task GetAvailableEventHandlersAsync() { int workspaceId = 1018486; using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { List<MassOperationLayoutResponse > response = await massOperationManager.GetAvailableEventHandlersAsync(workspaceId); foreach (MassOperationEventHandlerResponse eventHandler in response) { string info = string.Format("Read event handler {0} with Artifact ID {1}", eventHandler.Name, eventHandler.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
When you add a mass operation that uses an event handler to an object type, you must select a layout that displays after the user initiates the operation in the Relativity UI. You can retrieve a list of layouts available for the object type by calling the GetAvailableLayoutsAsync() method. For general information about layouts, see Create an object type.
The following code sample illustrates how to call the GetAvailableLayoutsAsync() by passing the Artifact ID of the workspace containing the layouts to retrieve, and the Artifact ID of the object type associated with the layouts.
public static async Task GetAvailableLayoutsAsync() { int workspaceId = 1018486; ObjectTypeIdentifier objectType = new ObjectTypeIdentifier{ ArtifactID = 1246375 } using (Services.Interfaces.MassOperation.IMassOperationManager massOperationManager = serviceFactory.CreateProxy<Services.Interfaces.MassOperation.IMassOperationManager>()) { try { List<MassOperationLayoutResponse > response = await massOperationManager.GetAvailableLayoutsAsync(workspaceId, objectType); foreach (MassOperationLayoutResponse layout in response) { string info = string.Format("Read layout {0} with Artifact ID {1}", eventHandler.Name, eventHandler.ArtifactID); Console.Write(info); } } catch (Exception ex) { Console.WriteLine(string.Format("An error occurred: {0}", ex.Message)); } } }
Community Updates |
|||
Aero Developer FAQ | Evolving the Platform | Most recent release notes | |
Learn more | Learn more | Learn more |
Additional Resources |
|||
![]() |
![]() |
||
Access Third-Party Tools with GitHub | Create .NET Apps Faster with NuGet | ||
Visit github | visit nuget |