multipleObjectPicker not saving CatalogItems
Hello,
I want to add CatalogItems to a Change Request Form via a multipleObjectPicker, and I can select the items but when I save the form the selected CatalogItems aren't saved. I'm not sure what the problem is.
This is how the code looks like
{
name: "CatalogItems",
rows: [
{
columnFieldList: [
{
name: "",
type: "multipleObjectPicker",
PropertyName: "WorkItemAboutCatalogItem",
ClassId: "e5151bc2-14b3-a138-dc31-9ef1fbc34728",
PropertyToDisplay: { DisplayName: "DisplayName", Status: "Status", FullClassName: "Type", LastModified: "LastModified" },
SelectableRow: true,
SelectProperty: "DisplayName",
},
]
}
]
}
Best Answer
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
@Mehwish_Shahid - Are you using a custom Type Projection for Change Requests? The Catalog Item relationship is not available on the default Portal Type Projection for CRs.
If you want to use that relationship, you'll have to use a Type Projection that has the WorkItemAboutCatalogItem relationship as a component.
5
Answers
@Mehwish_Shahid - Are you using a custom Type Projection for Change Requests? The Catalog Item relationship is not available on the default Portal Type Projection for CRs.
If you want to use that relationship, you'll have to use a Type Projection that has the WorkItemAboutCatalogItem relationship as a component.
Yeah, that's probably it. Thanks.
@Justin_Workman After talking internally about it, we are actually not sure how to go about this best. Where can we see the default TypeProjection for Change Requests so we can base our own on that?
The default projection for CRs is Cireson.ChangeRequest.ViewModel. You can see what components are in it by using this powershell:
Get-SCSMTypeProjection -Name Cireson.ChangeRequest.ViewModel
You can specify a new projection in Admin Settings -> Group Settings in the portal.
If you need to create a Type Projection, I just posted this that should help:
https://community.cireson.com/discussion/5324/scsm-projection-builder
This sounds really helpful! Thanks I will try it out :)
So we made a new Type Projection and assigned an AD group under Admin Settings and bound it to our CR custom form (like described in this KB article https://kb.cireson.com/article/how-to-use-custom-relationship-types-in-custom-forms-in-the-cireson-portal/1174).
But it's still not saving the added Catalog Items to the form.. what else could be the problem here?
I changed the PropertyName to "CatalogItem" since it's the Target ID of the relationship "WorkItemAboutCatalogItem":
columnFieldList: [
{
name: "",
type: "multipleObjectPicker",
PropertyName: "CatalogItem",
ClassId: "e5151bc2-14b3-a138-dc31-9ef1fbc34728",
PropertyToDisplay: { DisplayName: "DisplayName", Status: "Status", FullClassName: "Type", LastModified: "LastModified" },
SelectableRow: true,
SelectProperty: "DisplayName"
},
]
Is there something else we need to do?
@Mehwish_Shahid - A couple of things. Did you recycle the app pool? When you make a form assignment in Admin settings->Group Settings you have to recycle the app pool for it to take effect. Also, do make sure you have the correct relationship name(PropertyName in the picker definition) for the picker. You can open the browser's Dev tools(usually by hitting F12) while on the form you're customizing and in the console you can type pageForm.viewModel.NameRelationship and see what relationships are present in the view model. The name that's listed (may differ from what you're expecting) is what the picker will need.
@Justin_Workman We recycled the app pool now and I checked the pageForm.viewModel.NameRelationship and CatalogItem is the right name. But the form is still not saving them..
@Mehwish_Shahid - If you check the relationship in powershell by using Get-SCSMRelationshipClass do you see the name of the target returned by that command in pageForm.viewModel? The Target is what you actually want bound to the multiObjectPicker.
@Justin_Workman Yes I checked it now and it's the same: Target is CatalogItem and Source is WorkItem.