How to retain the input data in html of Service Portal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 05:05 AM
Hi All,
I have a service portal widget where I want to maintain the data which user has inserted in html . Is there any way like local storage in service portal.
Thanks,
Prachi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 01:43 PM
Hello Prachi,
Can you elaborate on your requirement? It's not quite clear what you're asking for; what is happening vs. your expected outcome? Screenshots, code, etc. are all helpful.
Please mark my answer as correct/helpful if it has helped you.
Thanks,
Logan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 05:39 PM
This might be similar to your requirement.
https://community.servicenow.com/community?id=community_question&sys_id=62d1ab881b2c1410a59033f2cd4bcbfd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:07 PM
Hi,
In your HTML widget you need to use ng-model to store the date which can be used in other widget component like client controller or Server portion as well.
For example:
In my HTML on a page I have a Text box as shown below in my code:
HTML:
<div>
<div>${UserName:} <input type="text" class="form-control" ng-model="data.loggedUser"/></div>
</div>
Now I can use the model, to hold the value which need to be displayed and is getting fetched from Server component.
Server Side:
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.loggedUser = gs.getUserName();
})();
Similarly you can do the reverse, define a ng-model as shown above and what ever user fills it in that field you can use ng -model to play around with the data either in client or Server as you want.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke