- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:06 PM
Hi folks,
I was wondering any advice to write values back to a HTML variable in a record producer within a Widget under a Service Portal.
The HTML object is one of the Record Producer variables; when record producer loads, it displays as a HTML editor as below
It has no values by default (see above screenshot), and my goal is to dynamically populate table (see a prototype below) into this HTML object.
Firstly, I will have to fetch this HTML object. which I know is rendered under a body id=tinymce (see below element inspections)
Therefore below is the Widget client Controller (Client Script) to populate the table, I have tried a various ways to write a dummy value back to this HTML object, but none of them have seemed to work so far.
I was wondering if anyone could help; It would be much appreciated for your feedback.
Kind regards,
George
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:50 PM
Hi George,
I think you can achieve it by accessing the element from scope data and I am afraid that's the only way to achieve it at present as other javascript objects are not accessible within a client script in widgets.
You just need t replace the sysId here with the sys_id of your HTML variable. I tried and it worked out for me.
$scope.data.sc_cat_item._fields["IO:4a6410e80fa90300e42306bce1050ec5"].value = "place your dummmy value";
//replace IO:4a6410e80fa90300e42306bce1050ec5 : "IO:sys_id" of your variable
PS: You can also try with catalog client script to populate it.
Please mark correct/helpful based on the impact of the response.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 11:50 PM
Hi George,
I think you can achieve it by accessing the element from scope data and I am afraid that's the only way to achieve it at present as other javascript objects are not accessible within a client script in widgets.
You just need t replace the sysId here with the sys_id of your HTML variable. I tried and it worked out for me.
$scope.data.sc_cat_item._fields["IO:4a6410e80fa90300e42306bce1050ec5"].value = "place your dummmy value";
//replace IO:4a6410e80fa90300e42306bce1050ec5 : "IO:sys_id" of your variable
PS: You can also try with catalog client script to populate it.
Please mark correct/helpful based on the impact of the response.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 03:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 07:16 PM
Great 🙂
Happy to help you.
Just wanted to add one more thing. I hope you are using this widget only for this cat item as if the syd_id object for the html variable is not found, its gonna run into errors.
Please add a null check before the second link of the code where we are trying to set the default value just to make sure we dont end up breaking other cat items.
Thanks
Gaurav