- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:10 AM
Hi All, Need a little help why my onload script does not work. My concern is to be able to set the variables to read only after approval. Anyone can confirm about my 'if' statement? It doesn't work. function onLoad(){ //Type appropriate comment here, and begin script below if(g_form.getValue('approval' == 'approved')){ g_form.setReadOnly("variables.variable_name", true); I tested without the if condition and the field is being set to ReadOnly, so I can confirm that my if statement is incorrect. Anyone can advise? Thanks in advance. Ramel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 07:39 AM
My issue was resolved by using g_form.getReference('parent'); then if condition which is approval = approved. With that I was able to set the variables in the task as readonly after approval.
Thanks all for the replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:22 AM
To add, Catalog UI policy is recommended in case this is for catalog item. For record producers you might have to go with client script approach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:30 AM
Hi Berny, It is for Record Producer and not Catalog Item that is why I use client script. Thanks, Ramel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:21 AM
Hi Ramel,
Change if statement from if(g_form.getValue('approval' == 'approved')) to if(g_form.getValue('approval') == 'approved')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:28 AM
Hi Pradeep,
Yes this is for Record Producer. I have tried your suggested code for the if part: if(g_form.getValue('approval') == 'approved') and still did not work for me.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:30 AM
Can you put alert statement in your code and make sure you are checking against right choice value.
var app = g_form.getValue('approval');
alert(app);