Ticket Number

Home Forums Requests Ticket Number

Viewing 3 reply threads
  • Author
    Posts
    • #19703
      Jon Mortimer
      Participant

        Any possibility there would be a way to generate a unique ticket number within DFFS? I was planning to use ID but that does not generate until the record is saved and then its too late to be used within emails and whatnot.

        I used to use a workflow to generate the unique number but since I want to use the DFFS Emails functionality, the workflow would generate the number after the emails go out. So if I wanted to send an email to a user with Your Ticket # is 5, there wouldn’t be a way to do that as it exists, as far as I know.

        Any help would be greatly appreciated!!

      • #19736
        Alexander Bautz
        Keymaster

          If you need this number in NewForm you must generate a unique number. Theoretically you could run a function to “sniff” the next list item ID based on the latest item added, but this wouldn’t be reliable when multiple users add items at the same time.

          If your number can be long and difficult, you can use the built in “_DFFSID” (single line of text – if you don’t have it in your form you can add it). This field contains an ID based on the current date in milliseconds – something like this: 1518264129798

          If this is to complex, it might be a solution to use code to redirect from NewForm to EditForm when the ticket is first registered to send the emails from EditForm instead. Look at this example: https://spjsblog.com/2015/10/13/redirect-from-newform-to-editform-in-dffs/

          Alexander

        • #19738
          Jon Mortimer
          Participant

            Thanks Alexander.

            I do like option #3 although it changes the way we add tickets a bit. So bear with me here but I added these lines:

            after “newItem = spjs.utility.addItem…..”
            alert(“Your ticket is “+newItem.id);

            and
            after “location.href = url;”
            setFieldValue(“ProjNum”,”ABC-“+newItem.id);

            On the NEWFORM, I click save and am prompted with the ticket number (alert) [ABC-42] and I can see the ProjNum field being populated [ABC-42]. However, when I get to the EDITFORM the ProjNum is blank. So I must have something in the wrong place?

            Is this even possible? I’m guessing it may be because of the newItem line and the ID not yet being assigned, etc.

            • #19740
              Jon Mortimer
              Participant

                Okay, I think I figured out a solution. I think in my head I was over-complicating things. Let me know if this is the right thing to do in your mind.

                In the EDITFORM I simply used the “Set Field Value” for ProjNum = ABC-{ID} (only if blank). This way anytime the editform is opened and the field is blank it will assign the ID as the project number. The emails now trigger from the EDITFORM so when the user hits Save, the project number is there and is included in the emails.

            • #19809
              Alexander Bautz
              Keymaster

                Hi,
                Sorry for the late reply. Yes, this is the way I meant it to be solved.

                Let me know if you have any further questions.

                Alexander

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