- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 05:25 AM
Hi,
I have been trying to set a value on my requested item form through an OnSubmit catalog client script, but to my surprise i'm unable to set it.
I'm wondering what went wrong, i have also included a timer for 30 secs on the workflow which didn't give any results.
Below is the code snippet
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('var_req') != ''){
g_form.setValue('u_input','4 hours');
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 06:12 AM
As stated earlier, you will not have direct access to the created item from client script. You would need to create a hidden variable, set it. Then it would get pushed into the field on the target record through naming convention.
OR, you can use the script within the catalog item definition. I posted a image of the script field. You would have access to producer variables and the current target record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 06:09 AM
Also my input to the u_input field is dependent on more than one variable for different catalog items, as my workflow is being used in more than one catalog item, i cannot either use a business rule to set value. If i have use a business rule i'll have hardcode the catalog item and check for the variable values for the respective catalog item.
Thanks,
Srikanth Varma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 06:12 AM
As stated earlier, you will not have direct access to the created item from client script. You would need to create a hidden variable, set it. Then it would get pushed into the field on the target record through naming convention.
OR, you can use the script within the catalog item definition. I posted a image of the script field. You would have access to producer variables and the current target record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 06:45 AM
Hey Aaron,
Thanks for the idea, a hidden variable can do wonders for me. Not sure why i haven't thought of it earlier .
Now i'll use this hidden variable and write an onSubmit write, i'll also write a before BR on sc_req_item to set the variable value into the field.
Thanks a lot .