current.isNewRecord() gives false when used in calculation field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 09:21 AM
current.isNewRecord() gives false when used in calculated value on a field on a change record for create newswhen used in calculation field on a change record for create new
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 10:30 AM
That's true. so current.isNewRecord() should return true when I create a new record, right ? or you meant to say that current wonnot work at all?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 10:31 AM
Current won't work in the calculated field because the field isn't created until after it is created (chicken and egg scenario.)
In a script, it makes perfect sense to say:
if (current.isNewRecord())
// user is looking at a new form - nothing saved yet
else
// user is looking at the values from an existing record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 11:10 AM
Hmm.. it is not going into IF when I create new using the below, what I am missing? I want field to be false if new record, else have true value.
if(current.isNewRecord()){
gs.addInfoMessage("IF");
current.u_assessment = false;
}
else{
current.u_assessment = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 11:12 AM
I have tried that too. For some reason it returns false all the time when I place a log. But, I cannot give you any explanation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 11:13 AM
What about setting the default in the dictionary to true, then use an onLoad client script like this:
function onLoad() {
if (g_form.isNewRecord())
g_form.setValue('assessment', false); // turn off the checkbox for brand new records only
}