How to send value to Html field using server/client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 11:20 PM
I need to send the value of incident task's description in the below field.
This field is in the portal.
<div class="edit_email" ng-if="edit">
<h2> Email Response: </h2>
<textarea style="width: 100%; margin-bottom: 20px;" ng-model="data.approval.task.description" ng-model-options={}>
</textarea>
</div>
This text area will come up when a user clicks on "Edit" option.
And this text are should contain the description of the current incident_task.
How do I pass the description value to this field.
- Labels:
-
Service Portfolio Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 11:35 PM
Hi,
You can do it like this
HTML:
<textarea id="comments" name="comments" rows="4" cols="30" ng-model="c.data.comments">
</textarea>
Server Side:
if (input && input.op && userApprovalAccess) {
gr.comments = input.comments;
}
In var field line,
use this
var fields = $sp.getFields(gr, 'state,sys_created_on,comments');
use this below data.fields = fields;
var work = gr.comments.getJournalEntry(1);
var array = work.split(")");
data.comment = array[1];
Now,In comments we have got comment we entered
In HTML to display server side data use
Comment:<div>{{c.data.comment}}</div>
It will pass data from HTML to server side
Please mark correct and helpful if it helps you.
In case of any further, message me.
Regards
Anmol Saraswat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 11:36 PM
You can refer to these links for further information:
- https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/build/service-portal/concept/wid...
- https://serviceportal.io/communicating-between-the-client-script-and-the-server-script-of-a-widget/
- https://serviceportal.io/docs/
Please mark this response as 'Helpful' if this answers your question or reply to me if you have any other queries.
Thank you.