Home Analyst Portal

ObjectPicker not saving value

Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
Hi

I extended my Service Request form to create a link to the Cost Center.
I added a ObjectPicker to the form so users can enter the cost center.

The list is loading correctly and we can select a value. But as soon as we click Apply (or Save), the value disappears.
I can't find what I'm doing wrong.

Relationship in ManagementPack
<RelationshipType ID="HasCostCenter" Accessibility="Public" Abstract="false" Base="System!System.Reference">
<Source ID="Source_296957f3_8850_4f54_ae24_6cc240d42cb7" MinCardinality="0" MaxCardinality="2147483647" Type="Alias_6c4a665b_b08f_4f6c_9954_da5815f527f0!System.WorkItem.ServiceRequest" />
<Target ID="Target_df2e0757_0927_44ff_9844_5bd8958fa771" MinCardinality="0" MaxCardinality="2147483647" Type="Alias_04280a31_ee8a_4223_b8a2_1c702aa2f6b8!Cireson.AssetManagement.CostCenter" /></RelationshipType>

ServiceRequest.js
{ DataType: "ObjectPicker", PropertyDisplayName: "CostCenter", PropertyName: "Target_df2e0757_0927_44ff_9844_5bd8958fa771", ClassId: "128bdb2d-f5bd-f8b6-440e-e3f7d8ab4858" },

Answers

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Hi Valerie,

    Did you include the Service-Request-to-Cost-Center relationship in a new Service Request type projection, and did you map that type projection in the "Assign forms to active directory groups" portion of "Admin Settings"?

    If you or anyone reading this is unfamiliar, a type projection (sometimes referred to as a combination class in the console) is a grouping of relationships to a base class/module (ie. Incident, Service Request, Hardware Asset). The Portal/Console will load every grid/form using a type projection in order to bring over relationships it needs that are not part of the base class. For example, "Affected User" and "Assigned User" are brought over in many type projections for the Incident Class-- if you wanted to view or update either of these relationships, they would need to be included in the type projection. Ideally, type projections include only the relationships you need because even if not shown on a grid/form, a grid/form will still pull every relationship specified in a type projection (can lead to slowness if bringing over many unneeded relationships for many items).

    Thanks,
    Nick
  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Hi Nicholas

    Yes I did create a type projection and mapped it in the Form section!
    But not sure it's working correctly. Any way to verify this?

    Valérie
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    If you hit F12 in your browser, go to the console tab, and type    pageForm.viewModel     ...do you see the relationship listed there?
  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Yes, I can see the relationship listed.

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    What happens if you try to make the PropertyName "HasCostCenter" in the control in the ServiceRequest.js file?
  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Nicholas - this gives the same result> I can select a cost center but as soon as I hit apply, the selected value is gone.
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Barring that, the next thing I would try is to test if the issue is bi-directional. Try to set that relationship on a Service Request outside of the Portal (either via PowerShell or the SCSM Console), and see if the pre-set value loads on the page and/or in the viewModel.
  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Using Powershell to create the relation works, but is not desplayed on the portal.

  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Sorry - was a bit to fast.
    Changed the PropertyName back to the Target_GUID, and I can now see the value setted by PowerShell.
    And for this SR , I can change and update the value and it continues to work as expected.

    And same for other SR. I don't know why it started to work now ?
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Could be that the CacheBuilder needed to finish processing, or something was cached in the browser. Either way, glad its working now!
  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭
    Ok, but this was just in test.
    I'm now trying to update this in production. But as I have no idea what made it work, it's a bit difficult :)
  • Tuan_LuuTuan_Luu Customer IT Monkey ✭
    edited April 2017

    { DataType: "ObjectPicker", PropertyDisplayName: "Change Request", PropertyName: "Target_d9dfd53c_4c08_408f_9b7d_8dd7513817e3", ClassId: "E6C9CF6E-D7FE-1B5D-216C-C3F5D2C7670C", Disabled: false }

    "E6C9CF6E-D7FE-1B5D-216C-C3F5D2C7670C" --> is the class id System.WorkItem.ChangeRequest

    For some reason the objectpicker does not load Change request work item



Sign In or Register to comment.