Customize CI Search
Anyone know of a way to accomplish this?
Thanks!
Best Answer
-
Tom_Hendricks Customer Super IT Monkey ✭✭✭✭✭The relateditems control refers to a fully-configured control that exists in another file somewhere. What you want to do is create your own control, using the same relationship (they can both exist on the form, if you like).
Example 1, if you want to use the existing Related CI relationship:{ DataType: "ObjectPicker", PropertyDisplayName: "
Related Service
", PropertyName: "RelatesToConfigItem", Required: false, ClassId: "b2a806a6-87f6-0bc9-da74-c27e9ab5a5d7"<br>},<br>
Example 2, if you define the WorkItemImpactsService relationship in your form's type projection (see this KB for a good intro/explanation of type projections):{ DataType: "ObjectPicker", PropertyDisplayName: "
Related Service
", PropertyName: "ImpactedService", Required: false, ClassId: "b2a806a6-87f6-0bc9-da74-c27e9ab5a5d7"<br>},<br>
I have not tested it, but I believe it should work.
The property name is the target ID of the relationship. Each relationship has a source (work item, in this case) and a target. If you were using a relationship where work item is the target, I believe you can specify the source instead.
The internal ID for the Service class is the GUID that I put in ClassId in both examples.
I strongly recommend using the SCSM Entity Explorer for determining the names and IDs of these classes and relationships. It can be done with PowerShell and there are examples of that to be Googled, but this tool is much easier to use if you are just beginning.
Hope this helps!
6
Answers
This article in the Cireson support KB is the starting point for explaining how to do this.
What I did so far was move the out of the box "relateditems" section to the general tab. But I don't think I can make this required.
I see in ChangeRequest.js where I can set required on something like a userpicker, again exactly what I need.
Your suggestion makes complete sense, but I have no idea how to perform the execution. Any tips on where to start for a newbie?
Let me elaborate. I'm trying something along these lines, but it's not working, as expected since I made it. Still looking for an example post out there, but coming up empty.
]
Example 1, if you want to use the existing Related CI relationship:
Example 2, if you define the WorkItemImpactsService relationship in your form's type projection (see this KB for a good intro/explanation of type projections):
The property name is the target ID of the relationship. Each relationship has a source (work item, in this case) and a target. If you were using a relationship where work item is the target, I believe you can specify the source instead.
The internal ID for the Service class is the GUID that I put in ClassId in both examples.
I strongly recommend using the SCSM Entity Explorer for determining the names and IDs of these classes and relationships. It can be done with PowerShell and there are examples of that to be Googled, but this tool is much easier to use if you are just beginning.
Hope this helps!
Thanks again for your assistance. I was able to get this working by adding this to ChangeRequest.js
And there was much rejoicing!
I can go over to the Console and update the work item without issue.
So, I went back and edited ChangeRequest.js and removed the required property from the field, and then I can submit changes again.
Can anyone identify why I can submit the CR with the field populated and set to required, but cannot update MAs or RAs with it set that way?
Some ideas:
My theory here is that the object may be saving with a different (but still correct) class, which then does not appear in the form. If true, some ways to solve it might be using a different (higher- or lower-level class that Service inherits from) class, or creating a type projection and using that relationship instead of the more generic RelatesToConfigItem.
After reading your last post, I decided to take another look at that KB article that you linked about Type Projections and yes, that is what was needed to finally get this working. Certainly, I have not done a lot of authoring yet, but that KB article was straightforward (as soon as I let myself understand the content and not get frustrated).
After creating the type projection and importing the management pack, I edited the ChangeRequest.js form with the guid of the relationship added to the Change Request class.
Now I can update the form without issue. Not only did I get the exact results I was looking for, but I learned some valuable information on how to author in Service Manager.
One more time, thanks again for the patience and the help.