locked
New to creating custom form -- possible Type projections issue RRS feed

  • Question

  • Crating my First MP (MPB) that has a custom form.
    I have Created 3 management packs and sealed them
    1 ERPCustomList
    2 ERPChangeRequestMP
    3 ERPCustomForm
    Then
    - In the Custom List MP, I created 2 lists
    - In then Change Request MP I added 4 properties
      --ERP Area - String
      --ERP Module - String
      --Tester - Relationship – Active Directory User
      --Approver – relationship – Active Directory user
     In the Custom form MP, I have added the 4 properties from the change request to the custom form with a base off of “Change Request Form” using “Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Forms.dll” as the assembly.
     
    I have bundled all that up into a MPB and imported it into SCSM, I am able to create a template no problem but when trying to create an actual work item off that template the console crashes on me.
    After doing some reading from various blogs post I am pretty sure my issue is due to the relationships and type projections (or the lack there of).  I have tried to follow some of the blogs but just can seem to get it right.
    I am not sure where the type projections should go, in the class mp, in the form MP or in a separate MP all together.   I have tried to create a separate MP just for type projections but don’t know how to seal it as it won’t open in the authoring tool.


    • Edited by romualdt Tuesday, August 7, 2018 9:43 PM
    Tuesday, August 7, 2018 9:39 PM

Answers

  • I figure it out.   After several attempts and changes I finally got everything to fall in place.

    I thing I noticed I had set both of the custom relationships to the same target.  I discovered this using PowerShell and checking what relationships were in my MP  both were sent to target.

    and the then I finally got the reference to my MP type projections correct.

     
    Tuesday, August 14, 2018 8:01 PM

All replies

  • You can add the Type Projections just in the same MP where the Relationships are defined.

    Hope this helps.


    Andreas Baumgarten

    Wednesday, August 8, 2018 6:56 AM
  • Does the code below look right -- particularly my type projections?

    The final MPB imports just fine and My String and Enum Properties show up in the extensions.  

    When I create a new MP for my custom Form based on the new class and bundle it with the assembly file the service manager Console Crashes when I try to create a template. This is even before I add any of the custom properties to the form.  I simply Created the new form based on the change request form the seal and bundle it. 

    Would the type projections be part of the issue if I am not even adding the properties to the form?

      <?xml version="1.0" encoding="utf-8" ?>

    - <ManagementPack SchemaVersion="2.0" ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <Manifest>
    - <Identity>
      <ID>BlueChangeRequestsMP</ID>
      <Version>1.0.0.24</Version>
      </Identity>
      <Name>SJERPChangerequestV4</Name>
    - <References>
    - <Reference Alias="Windows.Lib">
      <ID>Microsoft.Windows.Library</ID>
      <Version>7.5.8501.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    - <Reference Alias="SystemLib">
      <ID>System.Library</ID>
      <Version>7.5.8501.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    - <Reference Alias="ServiceMangerChangeRequest">
      <ID>System.WorkItem.ChangeRequest.Library</ID>
      <Version>7.5.7487.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      </References>
      </Manifest>
    - <TypeDefinitions>
    - <EntityTypes>
    - <ClassTypes>
    - <ClassType ID="ERPChanerequest.Class" Base="ServiceMangerChangeRequest!System.WorkItem.ChangeRequest" Accessibility="Public" Abstract="false" Hosted="false" Singleton="false">
      <Property ID="BBModule" Key="false" Type="string" />
      <Property ID="BBArea" Key="false" Type="string" />
      <Property ID="ERPModuleList" Key="false" Type="enum" EnumType="ERPModuleListEnum" />
      <Property ID="ERPAreaList" Key="false" Type="enum" EnumType="ERPAreaListEnum" />
      </ClassType>
      </ClassTypes>
    - <RelationshipTypes>
    - <RelationshipType ID="SJERPChangeRequestMP.Relationship.Tester" Base="SystemLib!System.Reference" Abstract="false" Accessibility="Public">
      <Source ID="Source" MinCardinality="0" MaxCardinality="2147483647" Type="ERPChanerequest.Class" />
      <Target ID="Target" MinCardinality="0" MaxCardinality="1" Type="Windows.Lib!Microsoft.AD.User" />
      </RelationshipType>
    - <RelationshipType ID="SJERPChangeRequestMP.Relationship.Approver" Base="SystemLib!System.Reference" Abstract="false" Accessibility="Public">
      <Source ID="Source" MinCardinality="0" MaxCardinality="2147483647" Type="ERPChanerequest.Class" />
      <Target ID="Target" MinCardinality="0" MaxCardinality="1" Type="Windows.Lib!Microsoft.AD.User" />
      </RelationshipType>
      </RelationshipTypes>
    - <EnumerationTypes>
      <EnumerationValue ID="ERPModuleListEnum" Accessibility="Public" Ordinal="1" Comment="Blue Bee Module" />
      <EnumerationValue ID="ERPAreaListEnum" Accessibility="Public" Ordinal="1" Comment="Blue Bee Area" />
      </EnumerationTypes>
    - <TypeProjections>
    - <TypeProjection ID="BB.TP.TestUser.Full" Accessibility="Public" Type="ERPChanerequest.Class">
      <Component Path="$Target/Path[Relationship='SJERPChangeRequestMP.Relationship.Tester']$" Alias="Blue Bee Tester" />
      </TypeProjection>
      </TypeProjections>
      </EntityTypes>
      </TypeDefinitions>
    - <LanguagePacks>
    - <LanguagePack ID="ENU" IsDefault="true">
    - <DisplayStrings>
    - <DisplayString ElementID="ERPChanerequest.Class">
      <Name>ERPChangeRequest</Name>
      <Description />
      </DisplayString>
    - <DisplayString ElementID="SJERPChangeRequestMP.Relationship.Tester">
      <Name>Blue Bee Tester</Name>
      <Description>Person Who will Test Changes In Day Old</Description>
      </DisplayString>
    - <DisplayString ElementID="SJERPChangeRequestMP.Relationship.Approver">
      <Name>Blue Bee Tester</Name>
      <Description>Person Who Will Approve Changes In Live</Description>
      </DisplayString>
      </DisplayStrings>
      <KnowledgeArticles />
      </LanguagePack>
      </LanguagePacks>
      </ManagementPack>

    Wednesday, August 8, 2018 10:18 PM
  • I don't think spaces are aloowed in the Alias of the Type Projection:

    <Component Path="$Target/Path[Relationship='SJERPChangeRequestMP.Relationship.Tester']$" Alias="Blue Bee Tester" />

    Any error message before the SCSM console is crashing? Anything in the Event-Log?

     

    Andreas Baumgarten

    Thursday, August 9, 2018 9:21 AM
  • I have made some progress.  It does not crash when  the template is created  but once I try to open the change request (WI) based off that template it crashes.

    Here is what is in the event viewer after the crash:

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: propertyName
       at Microsoft.EnterpriseManagement.UI.SdkDataAccess.DataAdapters.EnterpriseManagementObjectProjectionDataType.SetPropertyValue(Object source, Object value, String propertyName)
       at Microsoft.EnterpriseManagement.UI.SdkDataAccess.DataAdapters.BindableCachedDataItem`1.set_Item(String propertyName, Object value)
       at Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Forms.ChangeRequestForm.Initialize(IDataItem dataItem)
       at Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Forms.ChangeRequestForm.ChangeRequestDataContextChanged(Object sender, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyPropertyChangedEventHandler.Invoke(Object sender, DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.RaiseDependencyPropertyChanged(EventPrivateKey key, DependencyPropertyChangedEventArgs args)
       at System.Windows.FrameworkElement.OnDataContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Microsoft.EnterpriseManagement.UI.FormsInfra.FormViewController.<OnReadHelperPropertyChanged>b__16()
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.ShowDialog()
       at Microsoft.EnterpriseManagement.ConsoleFramework.WindowManager.GenericWpfWindowConstructor.BeginShow(ShowViewContext showViewContext, Object parent, Object view, AsyncCallback callback, Object state)
       at Microsoft.EnterpriseManagement.ConsoleFramework.ViewConstructor.BeginShow(ShowViewContext showViewContext, AsyncCallback callback, Object state)
       at Microsoft.EnterpriseManagement.ConsoleFramework.WindowManager.WpfWindowRecord.ShowWindow()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()





    • Edited by romualdt Thursday, August 9, 2018 6:16 PM
    Thursday, August 9, 2018 6:03 PM
  • I just want to point out that storing data such as classes, properties, and relationships in a management pack which you would then seal and import into SCSM, generally shouldn't contain Type Projections / Combination Classes or other things you may want to change/remove later on.

    Instead you should reference your sealed MP in a new management pack and create those additions.

    Friday, August 10, 2018 3:34 PM
  • If I understand correctly you are saying that the type projections should be in a separate MP altogether.  I am putting the custom form in a Separate MP.  Do you think having the type projections in a separate MP will help with my issue of the console crashing when I try and do anything with my custom form?
    Friday, August 10, 2018 5:11 PM
  • I figure it out.   After several attempts and changes I finally got everything to fall in place.

    I thing I noticed I had set both of the custom relationships to the same target.  I discovered this using PowerShell and checking what relationships were in my MP  both were sent to target.

    and the then I finally got the reference to my MP type projections correct.

     
    Tuesday, August 14, 2018 8:01 PM