- 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:35 AM
yes I have the correct choice value, in my case it is 'approved'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:22 AM
Looks like your parenthesis is not correct as :
g_form.getValue('approval') == 'approved'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:34 AM
If approval field is choice then place the back end value
g _form.get value('approval')==' value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 08:41 AM
I have already checked the correct choice value.. and it is 'approved' in my case, but it is not working. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 07:45 PM
I think the reason why it is not working is because the approval value is on sysapproval_group table wherein the fields that I need to make readonly are in the task table. How can I get the value if approval = approved in the approval table then pass it over to the task table so the fields can be set as readonly. Thanks.