Anyone have any experience creating many-to-many relationships in Service Manager? For example, I am looking to extend the "Business Service" class with an additional list of IT contacts. If anyone has any references on how to go about something like this, it would be much appreciated!
Here is the XML for a one-to-many
<RelationshipType ID="HasRelatedWorkItem" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source.CustomClass.HasRelatedWorkItem" MinCardinality="0" MaxCardinality="2147483647" Type="Client" /> <Target ID="Target.WorkItem" MinCardinality="0" MaxCardinality="1" Type="WorkItemLibrary!System.WorkItem" /> </RelationshipType>
In this instance, to make it many-to-many, you would need to change the MaxCardinality for the Target to 2147483647.
What about the form? The authoring tool does not seem to have the list box control to support this. Is this where you have to build something custom in Visual Studio?
Thanks!
Is this where you have to build something custom in Visual Studio?
Yes. 1-to-many and many-to-many relationships require a listbox control which the authoring tool doesn't have. Once you've created the relationship and added it to your form's type projection, you need to extend the business service form with a custom control. The custom control, in this case, would be a WPF UserControl that merely contains a listbox configured however you wish. The ItemsSource binding must then match the alias of your relationship's component in the type projection.
Anton's post will get you started building a custom control and extending an existing form with it. http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ The important part is to replace the XAML with your own xaml (in your case a listbox).
Incidentally, Foothill, the relationship you posted is many-to-1. The distinction is important :)
Here is the XML for a one-to-many
<RelationshipType ID="HasRelatedWorkItem" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source.CustomClass.HasRelatedWorkItem" MinCardinality="0" MaxCardinality="2147483647" Type="Client" /> <Target ID="Target.WorkItem" MinCardinality="0" MaxCardinality="1" Type="WorkItemLibrary!System.WorkItem" /> </RelationshipType>
In this instance, to make it many-to-many, you would need to change the MaxCardinality for the Target to 2147483647.
- Marked as answer by AndersAspMVP, Moderator 12 hours 10 minutes ago
Here is the XML for a one-to-many
<RelationshipType ID="HasRelatedWorkItem" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source.CustomClass.HasRelatedWorkItem" MinCardinality="0" MaxCardinality="2147483647" Type="Client" /> <Target ID="Target.WorkItem" MinCardinality="0" MaxCardinality="1" Type="WorkItemLibrary!System.WorkItem" /> </RelationshipType>
In this instance, to make it many-to-many, you would need to change the MaxCardinality for the Target to 2147483647.
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM
Here is the XML for a one-to-many
<RelationshipType ID="HasRelatedWorkItem" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source.CustomClass.HasRelatedWorkItem" MinCardinality="0" MaxCardinality="2147483647" Type="Client" /> <Target ID="Target.WorkItem" MinCardinality="0" MaxCardinality="1" Type="WorkItemLibrary!System.WorkItem" /> </RelationshipType>
In this instance, to make it many-to-many, you would need to change the MaxCardinality for the Target to 2147483647.
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM
Here is the XML for a one-to-many
<RelationshipType ID="HasRelatedWorkItem" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source.CustomClass.HasRelatedWorkItem" MinCardinality="0" MaxCardinality="2147483647" Type="Client" /> <Target ID="Target.WorkItem" MinCardinality="0" MaxCardinality="1" Type="WorkItemLibrary!System.WorkItem" /> </RelationshipType>
In this instance, to make it many-to-many, you would need to change the MaxCardinality for the Target to 2147483647.
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM
Is this where you have to build something custom in Visual Studio?
Yes. 1-to-many and many-to-many relationships require a listbox control which the authoring tool doesn't have. Once you've created the relationship and added it to your form's type projection, you need to extend the business service form with a custom control. The custom control, in this case, would be a WPF UserControl that merely contains a listbox configured however you wish. The ItemsSource binding must then match the alias of your relationship's component in the type projection.
Anton's post will get you started building a custom control and extending an existing form with it. http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ The important part is to replace the XAML with your own xaml (in your case a listbox).
Incidentally, Foothill, the relationship you posted is many-to-1. The distinction is important :)
- Marked as answer by AndersAspMVP, Moderator 12 hours 10 minutes ago
Is this where you have to build something custom in Visual Studio?
Yes. 1-to-many and many-to-many relationships require a listbox control which the authoring tool doesn't have. Once you've created the relationship and added it to your form's type projection, you need to extend the business service form with a custom control. The custom control, in this case, would be a WPF UserControl that merely contains a listbox configured however you wish. The ItemsSource binding must then match the alias of your relationship's component in the type projection.
Anton's post will get you started building a custom control and extending an existing form with it. http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ The important part is to replace the XAML with your own xaml (in your case a listbox).
Incidentally, Foothill, the relationship you posted is many-to-1. The distinction is important :)
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM
Is this where you have to build something custom in Visual Studio?
Yes. 1-to-many and many-to-many relationships require a listbox control which the authoring tool doesn't have. Once you've created the relationship and added it to your form's type projection, you need to extend the business service form with a custom control. The custom control, in this case, would be a WPF UserControl that merely contains a listbox configured however you wish. The ItemsSource binding must then match the alias of your relationship's component in the type projection.
Anton's post will get you started building a custom control and extending an existing form with it. http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ The important part is to replace the XAML with your own xaml (in your case a listbox).
Incidentally, Foothill, the relationship you posted is many-to-1. The distinction is important :)
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM
Is this where you have to build something custom in Visual Studio?
Yes. 1-to-many and many-to-many relationships require a listbox control which the authoring tool doesn't have. Once you've created the relationship and added it to your form's type projection, you need to extend the business service form with a custom control. The custom control, in this case, would be a WPF UserControl that merely contains a listbox configured however you wish. The ItemsSource binding must then match the alias of your relationship's component in the type projection.
Anton's post will get you started building a custom control and extending an existing form with it. http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/ The important part is to replace the XAML with your own xaml (in your case a listbox).
Incidentally, Foothill, the relationship you posted is many-to-1. The distinction is important :)
- Marked as answer by AndersAspMVP, Moderator Monday, September 07, 2015 7:01 PM