The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Service Portal Approval Record widget

JohnMMcLaughlin
Tera Contributor

Hi,

I'm having an issue with the Approval Record widget on the portal, in one of my service catalog items I have 4 checkboxes, now if the chackbox has a value of false, I don't want it to show on the Service Portal Approval Record widget.   I have a screen shot below where I have highlighted the fields.

find_real_file.png

However when I look at the exact same approval record in the app itself, the false fields are not showing, see the screen shot below

find_real_file.png

I think I need to some how modify this line of code in the Approval Record widget, but I'm not too sure what needs to be done.

<div ng-repeat="variable in item.variables | filter:{visible_summary:true}" class="m-b-xs" ng-if="variable_toggle">

If you need any further details please let me know and I will try and explain better,

Thanks in advance,

John.

1 ACCEPTED SOLUTION

Venkat122
Kilo Guru

include false in single quotes as it is a string type


<div ng-repeat="variable in approval.variables" ng-if="variable_toggle">


                          <label ng-if="variable.value != 'false'">{{::variable.label}}</label>


                          <div ng-if="variable.value != 'false'">{{::variable.display_value}}</div>


                      </div>


View solution in original post

6 REPLIES 6

Venkat122
Kilo Guru

Hi John,



Try below



  <div ng-repeat="variable in item.variables" ng-if="variable_toggle">


                                  <label class="text-muted" ng-if="variable.display_value != false">{{::variable.label}}</label>


                                  <div ng-if="variable.display_value != false">{{::variable.display_value}}</div>


                              </div>


This isn't working for me. I'm seeing all of my false checkbox variables.  My html:

 

<div ng-if="!data.isValid">
${Record not found}
</div>
<div ng-if="data.isValid">
<div class="panel panel-{{::options.color}} b">
<div class="panel-heading">
<h4 class="panel-title">${Approval request for {{::task.table}} {{::task.number.display_value}}}</h4>
</div>

<div class="panel-body">
<div ng-if="task.short_description">{{::task.short_description.display_value}}</div>
<div ng-if="task.opened_by"><label>${Opened by}</label> {{::task.opened_by.display_value}}</div>
<div ng-if="task.requested_by"><label>${Requestor}</label> {{::task.requested_by.display_value}}</div>
<div ng-if="::data.approver"><label>${Approver}</label> {{::data.approver}}</div>
<div ng-if="task.start_date"><label>${Start}</label> {{::task.start_date.display_value}}</div>
<div ng-if="task.end_date"><label>${End}</label> {{::task.end_date.display_value}}</div>
<div ng-if="task.price.value > 0"><label>${Price}</label> {{::task.price.display_value}}
<span ng-if="task.recurring_frequency.value != null"><label>${Recurring price}</label> {{::task.recurring_price.display_value}} {{task.recurring_frequency.display_value}}</span>
</div>

<div ng-if="data.items.length > 0">
<h4>${Items in this Request}</h4>
<div ng-repeat="item in data.items">
<h4>
{{::item.short_description}}
</h4>

<div ng-if="item.price">${Price} {{::item.price}}
<span ng-if="item.recurring_price">${Recurring price} {{::item.recurring_price}} {{::item.recurring_frequency}}</span>
</div>

<div ng-if="item.variables.length > 0" ng-init="variable_toggle=false">
<h5 ng-click="variable_toggle = !variable_toggle" style="cursor: pointer;">
<span class="glyphicon" ng-class="{'glyphicon-chevron-down': !variable_toggle, 'glyphicon-chevron-up': variable_toggle}"></span>
${Options}
</h5>
<div ng-repeat="variable in item.variables | filter:{visible_summary:true}" class="m-b-xs" ng-if="variable_toggle">
<label ng-if="variable.display_value != 'false'">{{::variable.label}}</label>
<div ng-if="variable.display_value != 'false'">{{::variable.display_value}}</div>
</div>
</div>

</div>
</div>

<div ng-if="data.variables.length > 0" ng-init="variable_toggle=true">
<h4 ng-click="variable_toggle = !variable_toggle" style="cursor: pointer;">
<span class="glyphicon" ng-class="{'glyphicon-chevron-down': !variable_toggle, 'glyphicon-chevron-up': variable_toggle}"></span>
${Options}
</h4>
<div ng-repeat="variable in data.variables | filter:{visible_summary:true}" ng-if="variable_toggle">
<label>{{::variable.label}}</label>
<div>{{::variable.display_value}}</div>
</div>
</div>
</div>
</div>
<sp-widget widget="data.ticketConversation" />
</div>

 

Screen shot of true and false values showing:

 

find_real_file.png

 

Help?

Venkat122
Kilo Guru

include false in single quotes as it is a string type


<div ng-repeat="variable in approval.variables" ng-if="variable_toggle">


                          <label ng-if="variable.value != 'false'">{{::variable.label}}</label>


                          <div ng-if="variable.value != 'false'">{{::variable.display_value}}</div>


                      </div>


JohnMMcLaughlin
Tera Contributor

Giri,



Thank you for the prompt reply, I had to tweak the code you provided slightly to make it work, but it is now working as expected.



Final code i used was:



                  <div ng-repeat="variable in item.variables | filter:{visible_summary:true}" class="m-b-xs" ng-if="variable_toggle">


                      <label ng-if="variable.display_value != 'false'">{{::variable.label}}</label>


                      <div ng-if="variable.display_value != 'false'">{{::variable.display_value}}</div>



Thanks again.