Clear HTML variable type value in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 02:22 AM
Let's consider a Variable abc and its Variable type is HTML.. I Want to populate the value in the variable abc based on the other variable selection.
I struck in clearing the HTML field value.
I used g.form.clearValue() and g_form.setValue to empty. In ui policy clear variable to true..
But the variable value is not clearing. Please suggest some solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 02:29 AM
Hi @siva54
It is working for me.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 03:02 AM
Hello @siva54 ,
You can achieve this without any code by following @Dr Atul G- LNG sir's solution, still if you want you can also use onChange client script and add your logic in there and add the below code to clear the variable value of your HTML variable type along with your existing functionality to populate the value.
var clearvalue = '';
g_form.setValue('abc', clearvalue);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket