Show or hide Widget by condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 02:07 AM
----------------
widget always hide
IF "state" field of "sn_hr_core_case" table is "7" THEN widget show
----------------
How can I write this condition (Script) in my widget?
Thank you so much!
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 02:15 AM
Hi,
In Server script you need to check the state of the ticket and set the flag as below
data.flag = true; //if state is 7
else
data.flag =false;
Then in HTML you just need to use
<h2 ng-if="data.flag" >
//May be you are calling widget here.
</h2>
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 02:46 AM
Hello,
Check below script,
<button id = "MyButton" ng-click="c.start()" >
<span ng-show="!c.flag">Click me</span>
<span ng-show="c.flag">Hide me</span>
</button>
<h1>{{c.data.name}}</h1>
</div>
<div class = "list" ng-show="c.flag">
<table id="t01" >
<tr>
<th>STATE</th>
<th>DESCRIPTION</th>
</tr>
/* widget controller */
var c = this;
c.data.u_business = 1;
c.flag = false;
c.start = function()
{
c.data.name="Hi";
c.flag=true;
}
}
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 02:59 AM
Hi,
Along with the script suggested by Pratiksha refer below link too.
Show/Hide a Button Widget based on "State" field on Form Widget
Mark it correct and helpful, if you find it useful to you.
Thanks
Bhagyashri Sorte.