Home Community Uploads
image

Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.

DISCLAIMER

All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.

Cireson does not and will not support or maintain these enhancements, extensions, and scripts.

For Team Cireson uploads click here.

Auto populate Primary Owner field

Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭

Hi All,

We would like to auto populate the primary owner field on incidents with the person logging the case. Just wondering if anyone has configured this and if so, how you wen't about it.

I figure it could be done with a custom workflow but this would not be immediately obvious when logging the case. (Would have to close the form etc before it updates).

The approach I am thinking of is to get the sesion.user (if Analyst) and auto fill in the "Primary Owner" field with the name property. This would happen instantly. The only thing I am not sure of is if there is a way I can trigger it only if the IR is new (never been saved). I would not want it to trigger each time the form is accessed by an analyst.

Any thoughts or advice would be apreciated.

Thanks,

Steve

Best Answers

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    Answer ✓

    Hi Brian,

    This solution is for the Cireson portal. In order to implement, just copy the above code into your custom.js file in the inetpub\CiresonPortal\CustomSpace folder.

    Regards,

    Steve


Answers

  • damon_mulligandamon_mulligan Cireson Consultant Advanced IT Monkey ✭✭✭
    Steve,
    Is your end goal to see the Created By for your Incidents? If it is, just add the Created By property to the IR form and disable it so it cannot be changed. The relationship is tracked, just not displayed by default on the Console or Portal forms.
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Or if you really want it - runbook it, attach to the Incident template for new IRs and then grab the Created By and set as the Primary Owner. I think it's a bit redundant, but certainly another way I think you can achieve this.
  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    edited November 2016

    Thanks for your thoughts everyone.

    We just want the behaviour that if an Analyst logs a case, they automatically take ownership of that case and become the primary owner (they may also become the assigned to).

    Geoff I have been thinking along the lines of what you suggested. The only thing with only checking if the field is blank is that if the system auto logs the case (end user sends an email to monitored mailbox), the first person to open the case will be set as the primary owner. I guess this may not be desirable if someone is just opening the case to check if it is relevent to them when it is auto logged.

    Can anyone think of a way to trigger a task only if the incident has not been created yet? Maybe there is some property that is null until the form is saved?

    That way I could do the following:

    1. If an Analyst opens a new Incident form (unsaved). Set that Analyst as the Primary Owner as they are logging a new case and should initially take ownership of it.

    2. If a case is auto logged by system (client sends email to monitored mailbox), it gets logged without a primary owner. If an analyst opens this IR form (that is already saved) it does not put them into the Primary Owner field.

    Damon, the created by would be an option but that would have to happen after the form has been saved (you would need to close the form and re-open it to see the field populated. I would also have to exclude the workflow account for when the case is autologged by the system (this is probably not a problem and easily do-able)

    Adam, I did think abou the runbook approach but I am not keen the delay involved with this approach.

    Appreciate all the input guys.

    Steve

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭

    Ah nice, didn't notice new in the URL. I'll try come up with something today. Thanks :)

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    edited November 2016

    Ok so I ALMOST have it working.

    Please note that I am not a java scripter so if you can see any issues/improvements please let me know :)

    Here is the code:

    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
        formObj.boundReady(function () {

            if (window.location.href.indexOf("New") != -1)
               {
                    var po = $('[data-control-bind="RelatesToIncident"]').data("kendoAutoComplete")
                    var analyst = session.user
                    po.value(analyst.Name)
        }
     
        });
    });


    The field now gets filled in but the little information (i) icon does not appear to the left of the name. Also if you save the form it doens't 'stick'

  • Adrian_PaechAdrian_Paech Customer Advanced IT Monkey ✭✭✭

    Works great!

    Thanks Steve!

  • Thanks for Sharing this! Moving to the new "Community Uploads" Category for better viability and to help anyone else wanting to implement \ learn :)
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    @Steve_Clarke Very nice solution. That's what great about this community we can keep reusing each other's code snippets to create bigger and better stuff.

  • Brian_GabelBrian_Gabel Customer IT Monkey ✭

    Cireson support referred me to this post so it must be the accepted answer. 

    Are you creating a new Task under the library in the SCSM Console and entering this code in the Command Line section?

    If so, what is the "Full Path to Command"?

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    Answer ✓

    Hi Brian,

    This solution is for the Cireson portal. In order to implement, just copy the above code into your custom.js file in the inetpub\CiresonPortal\CustomSpace folder.

    Regards,

    Steve


  • Brian_GabelBrian_Gabel Customer IT Monkey ✭

    Ahhh...the custom.js.

    Thanks!  Works perfectly.

Sign In or Register to comment.