Home Cireson Uploads
image


IT Monkey will place code here as examples of what Cireson's consulting team has to offer as well as examples for public consumption to benefit the Microsoft System Center community as a whole.

DISCLAIMER

All files and projects located here come as is and without any warranty or support. We will attempt to improve the projects as time goes on based on customer and community demand. Comments and improvements are welcome as well as customization requests. Your use of these Cireson Uploads is subject to our Terms of Use.


Cireson's support team has no information on these projects outside of what you have available and will not provide support for these enhancements, extensions, and scripts.

Dont forget to checkout solutions uploaded by our customers, partners and community members here.

Assign to Analyst by Group

IT MonkeyIT Monkey O.G.
edited January 2017 in Cireson Uploads

* v3.8.2 Tested for v3.8 Contributors: Nick Velich

The "Assign to Analyst By Group" task allows you to assign a Work item to a Support Group and an Analyst within that Support Group.

But what happens if you select a Support Group but do not select an analyst? Currently, the Portal allows you to omit selection of an analyst, and the following scenario can occur:


Support Group 1: Contains Analyst 1 Support Group 2: Contains Analyst 2

Work Item originally assigned to Support Group 1 and Analyst 1. The "Assign to Analyst By Group" task is used to assign to Support Group 2, but the "Assigned To" field is omitted. The Work Item is then assigned to Support Group 2 with Analyst 1 still as the Assigned To. We do not want this to occur.

The following code will clear the Assigned To field whenever (1) the "Assign To Analyst By Group" task is used and an Analyst is not selected; and (2) The Support Group field on the form directly is cleared. */

app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) {
    formObj.boundChange("SupportGroup",function (formObj, viewModel) {
        console.log("Support Group has changed");
        var vm = pageForm.viewModel;
        var newSupportGroupId = vm.SupportGroup.Id;

        if(newSupportGroupId == "") {
            if(vm.AssignedWorkItem != null && vm.AssignedWorkItem.DisplayName != null) {
                console.log("Clearing assigned to");
                vm.AssignedWorkItem.BaseId = null;
                vm.AssignedWorkItem.DisplayName = null;
                vm.AssignedWorkItem.set("AssignedWorkItem", { BaseId: '', DisplayName: '' });          
            }
        }
    });
});

app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
    formObj.boundChange("SupportGroup",function (formObj, viewModel) {
        console.log("Support Group has changed");
        var vm = pageForm.viewModel;
        var newSupportGroupId = vm.SupportGroup.Id;

        if(newSupportGroupId == "") {
            if(vm.AssignedWorkItem != null && vm.AssignedWorkItem.DisplayName != null) {
                console.log("Clearing assigned to");
                vm.AssignedWorkItem.BaseId = null;
                vm.AssignedWorkItem.DisplayName = null;
                vm.AssignedWorkItem.set("AssignedWorkItem", { BaseId: '', DisplayName: '' });  
            }
        }
    });
});

Download the attached .zip file below.

Comments

  • Chris_KeanderChris_Keander Customer Advanced IT Monkey ✭✭✭
    Thank you for this.  This fulfilled a feature request I was just about to submit :)
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Glad we could help! :)
  • Chris_KeanderChris_Keander Customer Advanced IT Monkey ✭✭✭
    Is there a version of this for CRs that doesn't have Support Group?  Just a straight up "Assign to Analyst" task that looks at members of a specific AD group?
  • Chris_KeanderChris_Keander Customer Advanced IT Monkey ✭✭✭
    Bump
  • Billy_WilsonBilly_Wilson Member Ninja IT Monkey ✭✭✭✭
    Any way to get this to be able to add the analyst first and select from their Support Groups?
  • Geoff_RossGeoff_Ross Cireson Consultant Super IT Monkey ✭✭✭✭✭
    Hi Billy,

    Would be doable with a completely custom task from scratch or something something like this - but opposite way round of course.

    https://community.cireson.com/discussion/885/replace-assigned-to-support-group-fields-with-cireson-assign-to-analyst-by-group-fields-in-portal

    Geoff
  • Joakim_NormannJoakim_Normann Customer Adept IT Monkey ✭✭

    We are not able to get this to work in version 9.4.1. When I switch supportgroup it doesn't clear the assigned to field. Is there any modifications that needs to be made in order for this functionality to work in version 9.4.1?

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭

    @Joakim_Normann

    You'll need to change var newSupportGroupId = vm.SupportGroup.Id; to var newSupportGroupId = vm.TierQueue.Id; for the incident task (and only for incident).

  • Joakim_NormannJoakim_Normann Customer Adept IT Monkey ✭✭

    @Konstantin_Slavin-Bo

    I have made the change you recommended above (only for the incident part), but it is still not clearing the assigned to field when I choose another supportgroup.

    I do have to mention that we have just setup our new lab environment and used the LCM tool to migrate. When I check the Tier queue list we have both our definied supportgroups, but there is also Tier 1, Tier 2 and Tier 3 in that list which I can't delete. If I choose for example Tier 1 then the assigned to field is cleared.

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    edited October 2019

    @Joakim_Normann

    Ah I see, you need to change formObj.boundChange("SupportGroup" ... to formObj.boundChange("TierQueue" ... too (for incident).

  • Joakim_NormannJoakim_Normann Customer Adept IT Monkey ✭✭

    @Konstantin_Slavin-Bo

    I have made the change but still the same problem.

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    edited October 2019

    @Joakim_Normann

    Try to clear your browser cache (CTRL+F5 or SHIFT+CTRL+F5), to be sure to get the newest version of the javascript code.

    And just to be sure, you are changing the support group using 'Assign to Analyst by Group'-task, right?

  • Joakim_NormannJoakim_Normann Customer Adept IT Monkey ✭✭

    @Konstantin_Slavin-Bo

    Seems to be something in our lab environment that is preventing it to work correctly. I applied the same changes in production and there it clears the assigned to field like it should. Thanks for letting me know what I needed to modify in the script.

  • Gerhard_GoossensGerhard_Goossens Customer Advanced IT Monkey ✭✭✭

    I'm having issues with portal version 9.6 and this task.

    In the console I can see "Support Group has changed" but it does not fire the "Clearing assigned to" part.

    It is affecting IRs and SRs. I have treid the fix above, cleared my cache and even treid with different browsers.

    It seems like this part on line 30 and 48 is not fiering "if(newSupportGroupId == ""){"

    It is happening on the test and prod environment

    Any suggestions will be highly appreciated

    Gerhard

  • Joakim_NormannJoakim_Normann Customer Adept IT Monkey ✭✭

    I haven't got it to work in our new Test and Prod environment as well running portal versions 9.4.1 and 9.4.2. I have the same problem as you @Gerhard_Goossens that the "clearing assigned to" is not being fired.

Sign In or Register to comment.