Home Analyst Portal

Set the Support Group Form Field

Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
Hi,
How do I set the Support Group field with different value using a custom task ?

Answers

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Hi @Waleed_Al_Mahmeed

    You can just set the value in the viewModel but it needs to be to the enum object, not just the DisplayName.
    pageForm.viewModel.set("TierQueue", enumObject);
    If its a static value, you can hardcode this but if you need something dynamic you will have to grab the enums objects via an API call first.
    var enumid = "c3264527-a501-029f-6872-31300080b3bf";
    $.ajax({
        url: "/api/V3/Enum/GetFlatList",
        data: {Id: enumid, itemFilter: ""},
        type: "GET",
        success: function (data) {
            pageForm.viewModel.set("TierQueue", data[2]);
        }
    });
    Good luck,

    Geoff
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    hi Geoff,
    Thanks for the quick responce. How do I grap the existing Service Requests / Incidents support groups enumid ?
    thanks
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    app.custom.formTasks.add('ServiceRequest', "Test", function (formObj, viewModel) {
             var enumid = "c3264527-a501-029f-6872-31300080b3bf";
    $.ajax({
        url: "/api/V3/Enum/GetFlatList",
        data: {Id: enumid, itemFilter: ""},
        type: "GET",
        success: function (data) {
            pageForm.viewModel.set("TierQueue", data[2]);
        }
    });
       });
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    Is this the correct syntax for the custom task to set the support group field ?

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Answer to question above about grabbing Support Group Enum Ids:

    There's a number of ways, my favourite is PowerShell with Smlets

    Get-SCSMEnumeration TierQueuesEnum$ | select DisplayName, Id
    Get-SCSMEnumeration SupportGroupEnum$ | select DisplayName, Id

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    As for the code above, that looks pretty good but is set to set to the 3rd object (index of 2) in the list of support groups. You might need to change that bit. What exactly are you trying to do?
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    I'm trying to grab a support group called "Network & Computer Security" and assign it to the support group field inside a service request form.I used the following custom task and nothing happened when clicking on the task.

    app.custom.formTasks.add('ServiceRequest', "Test", function (formObj, viewModel) {
             var enumid = "c3264527-a501-029f-6872-31300080b3bf";
    $.ajax({
        url: "/api/V3/Enum/GetFlatList",
        data: {Id: enumid, itemFilter: "Network"},
        type: "GET",
        success: function (data) {
            pageForm.viewModel.set("Network", data[1]);
        }
    });
       });
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    data[0] returned:
    Object {Id: "cd712f91-a26b-8ff8-133d-36f9f4b40d46", Text: "Network and Computer Security Section", Name: "Network and Computer Security Section", HasChildren: false, Ordinal: null…}
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    The code below solved my issue.

    pageForm.viewModel.set("SupportGroup", { Id: 'cddb649b-ddd5-51a0-c3d0-28b8b88342cd', Name: 'Network and Computer Security Section' });
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    Is there a way to grab the support group Id & Name from the currently logged in user from within a custom task?
  • Waleed_Al_MahmeedWaleed_Al_Mahmeed Customer IT Monkey ✭
    Thanks Geoff, I found the answer.
Sign In or Register to comment.