Create ID based on two columns
Posted: 16 Jan 2017
Hi, I am completely new to this. I am currently working on a small demo and it seems as if your solution maybe a good fit. I have downloaded and installed the demo version, which was simple. I am designing my first form. I would like to create an auto ID for the "Name" field on a Document Set. I have created a form for the New Form of the Document Set. I have two fields one is a single line of text, "Job Number: the other is an External data field, "Client". In my example I am just updating Name when either Job Number or Client changes. I would be open to a better solution as to when to update the Name field, not suse if you have some sort of "on close" event that I should update Name on. I would think the event has to occur before save occurs as Name is a required field. Well this is what I came up with and it doesn't work.
//Function to create the id and set it to the Name field
function setAutoID() {
//Get Job Number field single text field
var job = fd.field('Job Number').value();
//Get client name from external data field
var cust = fd.field('Client').value().dictionaryEntries[0]['Client'];
//create value for id = job + cust
var id = job +' '+ cust;
//set Name field to the id value
fd.field('Name').value(id);
}
// When the job number field changes update the id
fd.field('Job Number').change(setAutoID());
// When the client name changes update the id
fd.field('Client').change(setAutoID());
Thanks for any help.
//Function to create the id and set it to the Name field
function setAutoID() {
//Get Job Number field single text field
var job = fd.field('Job Number').value();
//Get client name from external data field
var cust = fd.field('Client').value().dictionaryEntries[0]['Client'];
//create value for id = job + cust
var id = job +' '+ cust;
//set Name field to the id value
fd.field('Name').value(id);
}
// When the job number field changes update the id
fd.field('Job Number').change(setAutoID());
// When the client name changes update the id
fd.field('Client').change(setAutoID());
Thanks for any help.