- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2012 04:12 PM
I'd like to update the comments field for a ticket in a ui page and am having trouble figuring out how to pass the value from a textarea field int othe processing script.
In my HTML I have this:
<g:ui_form> <g:dialog_buttons_ok_cancel ok="return true" /> <input type="hidden" name="incident_id" value="SYS_ID_OF_TICKET"/> <textarea id="comments" name="comments"></textarea> </g:ui_form>
My processing script has this:
var inc = new GlideRecord('incident'); inc.get(incident_id); inc.comments  = document.getElementById('comments'); inc.work_notes = "this is a test"; inc.update(); var urlOnStack = Packages.com.glide.sys.GlideSession.get().getStack().bottom(); response.sendRedirect(urlOnStack);
document.getElementById('comments'); does not work and I'm really not sure what to put here to pull the value from the comments textarea into the processing script. If it's possible to do inc.get to an input field to query the table, you'd think there would be a way to pass other form fields into a business rule.
Does anyone have any idea?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2012 05:28 PM
Try the following line instead:
inc.comments = comments;
The values of each form input are available via a variable with the same name as the name attribute of input element.
Have you considered using a cut-down version of the Form (using a View), instead of a custom UI Page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2012 05:28 PM
Try the following line instead:
inc.comments = comments;
The values of each form input are available via a variable with the same name as the name attribute of input element.
Have you considered using a cut-down version of the Form (using a View), instead of a custom UI Page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2012 06:54 AM
Thanks Chris!
I feel dumb for not trying that first 🙂
We use views for our other ESS pages, but decided to use a custom UI Page this time because it allows more control over the layout of the content. This will be a read-only data (outside of customer communication) that users will want to copy/paste. Having all the content outside of form elements makes that easier and isn't as big an eyesore as a bunch of grayed out form fields.
Thanks again for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2012 08:18 AM
My pleasure, make sure you check the user has the rights to update the comments field (
), before updating the record.
inc.comments.canWrite()
SN Wiki: GlideRecord.canWrite
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2015 11:08 PM
Hi Zach,
Are you able to write into work_notes field by processing script?
I am having same requirement but facing issue.
Please let me know if your functionality is working fine.
Thanks & Regards,
Atul Chauhan