
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 02:19 AM
Hi folks
I need a UI Policy which only applies for a new form record.
Any ideas?
Any help is appreciated, thank you in advance.
Simon
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 02:27 AM
Hi,
if you need to make a field mandatory, visible or read only for a new record, then it's better to use an onLoad client script with the isNewRecord() function, see an example below:
if(g_form.isNewRecord()){
g_form.setMandatory('field_name', 'true'); ////provide field name here
}
else{
g_form.setMandatory('field_name', 'false');
}
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 02:26 AM
you need to use g_form.isNewRecord() in ui policy script part. that way you can identify the record is new or existing.
use script part to make the field read only , mandatory and visible

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 02:27 AM
Hi,
if you need to make a field mandatory, visible or read only for a new record, then it's better to use an onLoad client script with the isNewRecord() function, see an example below:
if(g_form.isNewRecord()){
g_form.setMandatory('field_name', 'true'); ////provide field name here
}
else{
g_form.setMandatory('field_name', 'false');
}
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 02:28 AM
sample script:
if(g_form.isNewRecord()){
g_form.setMandatory('field_name', 'true');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 04:22 AM
Hi Simon,
You can use method "isNewRocord()" from GlideForm in your script part.
eg. if(g_form.isNewRecord())
{
// some code
}
Please mark helpful or correct if you feel needful.
thanx,
Sushant