Set value of field not present on form using client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 09:00 PM
Is it possible to set the value of field which is not present on form but on table using client script.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 09:29 PM
Hi Ganesh,
Using g_form object we can set the value at client end but the field must be on form.
We are not able to set the value of field which is not on form at client end as this process is related to saving the data in database so it should be done at server side.(we can use the ajax call also at client end)
Thanks,
Pavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 09:40 PM
Hi Ganesh,
I am not sure if this is the right way to do it. But you can update the field in a UI action and then call the action from the client script using:-
gsftSubmit(document.getElementById('action_name'));
Also, I am not sure what your requirement is exactly, but if you are trying to do this from an onLoad client script, I would recommend that you use a display Business Rule. It is exactly like an onLoad script, but runs at the server side, so you can set value for any field on your table easily
Hope this helps Please mark this post as answered if this solves your problem
Thanks & Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 09:42 PM
Hi Ganesh,
You can set the value of the field available on the form by using the g_form object defined for client side scripting and the syntax would be
g_form.setValue('field_name', 'value');
If you are looking to set the same value on some other form then simply need to define a script include or a global business rule and then need to call same script from your client script using the GlideAjax call and can set this where ever you want to.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 08:48 AM
Hi,
For better visibility, I moved this thread out of the Community Updates & Feedback space and into the Support sub-community.
thanks,
Lawrence
-
Online Community Program Manager, ServiceNow