- 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-20-2016 02:17 AM
So you can gliderecord on approval table and verify the same condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 02:30 AM
Hi Ramel,
Somethings doesn't seem good.
You said you are using a record producer. What is the target table?
You are refering to approvers... So, are you creating requests through a record producer?
From the wiki:
"
Note: To ensure that standard service catalog processes are followed, such as initiating workflows as expected, do not create requested item records from record producers. Instead, create requested item using catalog items.
"
Telmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 03:11 AM
Hi Telmo,
Sorry for the confusion. Yes it is a record producer. Actually I am wrong about stating the target table being the approval table. I just found out that there is a hidden field in the request form for the approval and now after approval the choice value is approved. So I changed my code to
function onLoad(){
if(parent.approval == 'approved') { // since the approval is on the request level and this script is on task level
g_form.setReadOnly('variables.variable_name', true);
}
Still it is not working.. What could have been missing?
Thanks,
Ramel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 03:23 AM
Hi Ramel,
Ok, it is a recorder producer. The target table was the "approval table", what is now the target table?
Or what are you trying to accomplish with the record producer? What will be the outcome after submiting the Record producer?
Telmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 04:02 AM
Hi Telmo,
I have a record producer that is used to raise a request. Once request is created, it will have create tasks as well. Succeeding tasks will be created once the first task is closed. In the tasks created, I pass variables from the record producer to the task level via the workflow. I can already those variables from the record producer to the task but those variables need to be set as readonly after approval. From the creation of the request, one task is created and once that task is closed, approvals are required. So approvers have to approve, and once approved new task will be created. From the new task created after approval, that is where I want the variables to be set as readonly. I found that in the request form, there is hidden approval field where the value changes to approved once the approvers approved. But I cannot make my onload client script to work in a way that some variables in the newly created task will set as readonly. And that is what my issue is. Hope that makes it clear
Thanks
Ramel