- This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago by Alexander Bautz.
-
AuthorPosts
-
-
February 10, 2018 at 05:18 #19703
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!!
-
February 10, 2018 at 13:11 #19736
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
-
February 10, 2018 at 15:27 #19738
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.
-
February 10, 2018 at 16:34 #19740
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.
-
-
February 13, 2018 at 21:21 #19809
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.