Leather Knight Posted February 10, 2009 Posted February 10, 2009 I need a button to perform a task. I want it to create a new record but only have the content from a single field from the previous record be populated. It must be done from a button. Any advice on the way to accomplish this?
aldipalo Posted February 10, 2009 Posted February 10, 2009 Where is the button, on every record? If so, you need to track the previous recordID. Will your user be creating a new record from any record or just the last record entered? Just a simple script if it is from the last record input: Go to layout (Layoutname) Sort Records Go to Record/Request (Last) Set Variable($Field; Field to be copied) New Record/Request Set Field(CopiedField,$Field) The problem is if the user clicks the button on a record that is not the last record input you're getting the wrong data. You could put in a trap: Go to layout (Layoutname) Set Variable($ID; RecordID Enter Find() Set Field(RecordID; $ID+1 Perform Find() If(Get(Foundcount)>=1 Show Custom Dialog(You cannot create a new record from the current record displayed.) Exit Script EndIf Sort Records Go to Record/Request (Last) Set Variable($Field; Field to be copied) New Record/Request Set Field(CopiedField,$Field) I haven't tried the script so it probably needs a little tweaking. I'm also sure someone else will have a much more elegant approach, but, I think this will work for you.
Leather Knight Posted February 10, 2009 Author Posted February 10, 2009 The button is used to create a new record that will end up being related by the field "Location" and the field I need filled automatically is the "case number" so if there are 5 different locations in the same case number, as you push the button you will create a new record with the case number being the same as the one you click the button from, but the other fields are blank. I will try to tweek this script and see if it does it. I thank you fir this, I was drawing a blank..lol
FM Tid Posted March 6, 2009 Posted March 6, 2009 If my reply seems 1) too obvious and 2) wrong, then I've simply misunderstood what you said. There is an Auto-Enter field Option, "Value from previous record". Wouldn't that give you what you want? (In Scripts, it's under Fields - "Insert from last record"). As I say, I may have misunderstood what you asked.
bcooney Posted March 6, 2009 Posted March 6, 2009 (edited) "...related by the field 'Location' " say, it isn't so? I suggest using Location IDs. "..so if there are 5 different locations in the same case number" why aren't locations a portal off the case entry form related by CaseID? Edited March 6, 2009 by Guest
Recommended Posts
This topic is 5739 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now