Ticket Number (auto) and SLAs

Forums Classic DFFS Ticket Number (auto) and SLAs

Viewing 2 reply threads
  • Author
    Posts
    • #19606
      Jon Mortimer
      Participant

      I need a little direction on how I should approach this or if anyone else has done something similar (I’m sure) and the way they went.

      1. Ticket number – I have a site where we track tickets and each ticket is assigned a unique number. Currently using workflow to assign a unique number but wanted to get away from workflow if possible. Should I just use the record ID? Do I need to/should I assign this to another field? Or can I assign a unique ID within DFFS (if I need to)?

      2. Regarding SLAs. Currently I have SLAs that are specific to a combination of RequestType and Priority. These are within an SLA list. Can I use fields on my form (RequestType and Priority) to obtain the SLA (number) from another list? I attempted to use Cascading Dropdowns but the field needed to be text and when I tried to use that in conjunction with Custom JS the dropdowns stopped working (odd). I also thought about using a vlookup but this is more than I need. I think all I might need is a way to lookup the SLA in another list based on two fields in current record. Thoughts?

      Thanks in advance,
      I know this is a lot to take in but thought others may have already had experience with this. I think there might be multiple ways to go but wanted to try to select the “right” way to avoid issues down the road.

    • #19608
      Keith Hudson
      Participant

      #1. The way I have approached unique ticket numbers in the past is to use the ID number generated by SharePoint, but fancy it up just a little by prepending something to the number, such as “WBT-1470” instead of just “1470”. I create a single line of text column for the ticket number, and populate it on item creation through a simple, one step workflow. I’ve never had a problem with the workflow not firing. If you are determined NOT to use a workflow, this will not work, obviously.

      I’ve seen several articles online on how to pad the ID number so you always have a 5 digit number, for instance, but I just like to keep it simple.

      The challenge in using the SharePoint ID number is that it does not get assigned by SharePoint until a new item is saved. (It might be tempting to write some javascript to find the highest ID number on the list, and populate a ticket number field in the new item using that, but then you have to worry about collisions.) So, if you MUST know the ID number BEFORE the new item is changed, my approach won’t work.

      #2. Just a quick thought on this one, that perhaps a TicketPriority column on the new form for a ticket that concatenates the Request Type and Priority values (via a rule) would allow you to use Cascading Dropdowns to get the SLA from the external list. Simply add a new column to your external SLA list with all the possible concatenated values.

      Good luck.

      • This reply was modified 6 years, 2 months ago by Keith Hudson. Reason: Added paragraph about padding the ID number
    • #19647
      Alexander Bautz
      Keymaster

      Hi,
      1: If you don’t want to use WF you can use the item ID, but as Keith noted it will not be accessible for the user submitting the ticket as the number is assigned after it has been saved.

      If you need to have it in NewForm you can use a totally random number generated by a script (for example using the date in milliseconds – like this: 1518036134470. It will be unique, but impossible to remember….

      2: To find the SLA you can use a custom function and call it from a button in the form. This custom function can update a field in this list with the correct SLA.

      Add this to a HTML section in the form:

      <input type="button" onclick="getSLA()" value="Get the SLA">

      Then add this to the Custom JS:

      function getSLA(){
          var SLAGuid = "{ccbbf922-f0af-481b-b2c0-b12ea24d224e}"; // SLA list GUID
      	var rType = getFieldValue("RequestType");
      	var priority = getFieldValue("Priority");
          var res = spjs.utility.queryItems({"listName":SLAGuid,"query":"<Where><Eq><FieldRef Name='RequestType' /><Value Type='Text'>"+rType+"</Value></Eq><Eq><FieldRef Name='Priority' /><Value Type='Text'>"+priority+"</Value></Eq></Where>","viewFields":["SLA_FIELD_NAME"]});
          if(res.count > 0){
              var item = res.items[0];
      		var sla = item.SLA_FIELD_NAME;
      		setFieldValue("FIELD_IN_THIS_LIST",sla);
          }else{
              alert("No SLA found for this combination of request type and priority");
          }
      }

      Please change “SLAGuid” to match the list GUID or DisplayName and “RequestType”, “Priority” and “SLA_FIELD_NAME” to match your field names.

      This code has not been tested so it might need some tweaks to work.

      Alexander

Viewing 2 reply threads
  • You must be logged in to reply to this topic.