- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2016 06:28 AM
We use UI Policies to show and hide a lot of fields on the Change form based on the Category. When the approver looks at the approval view it shows all the fields from the Change form on the summarizer (formatter). We would like to only show fields related to the change category that is selected.
(not very good with jelly script and have been spinning my wheels trying to figure this out)
We're currently using the approval_summarizer_default ui macro
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2016 09:32 AM
We were able to add an if statement inside the g:evaluate
In this case, only one type of Category will need to have a different view. else if statements could be used to define specific views for each category (or another field from the change form if necessary)
We needed to create another view on the change form to match the one that is called in the else statement
<g:evaluate var="jvar_my_form">
var gc = new GlideController();
var p = new GlidePopup(gc, "${gr.getRecordClassName()}");
p.putParameter("sys_id", "${gr.sys_id}");
<!--gs.print("Test:"+"${gr.category}");-->
<!-- Category1 would be the value of the choice you are looking for from the category field -->
if("${gr.category}"=="Category1"){
p.putParameter("sysparm_view", "approval");
<!-- if the category is anything else show another view -->
}else{
p.putParameter("sysparm_view", "approvalnotcategory1");
}
//PRB579164: Skip g_form creation in activities.xml if activities displayed in formatter
p.putParameter("sysparm_skip_gform", "true");
var rp = p.getRenderProperties();
rp.setSmallCaption(true);
rp.setInlinePopup(true);
rp.setReadOnly(false);
p.getPopup();
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2016 09:32 AM
We were able to add an if statement inside the g:evaluate
In this case, only one type of Category will need to have a different view. else if statements could be used to define specific views for each category (or another field from the change form if necessary)
We needed to create another view on the change form to match the one that is called in the else statement
<g:evaluate var="jvar_my_form">
var gc = new GlideController();
var p = new GlidePopup(gc, "${gr.getRecordClassName()}");
p.putParameter("sys_id", "${gr.sys_id}");
<!--gs.print("Test:"+"${gr.category}");-->
<!-- Category1 would be the value of the choice you are looking for from the category field -->
if("${gr.category}"=="Category1"){
p.putParameter("sysparm_view", "approval");
<!-- if the category is anything else show another view -->
}else{
p.putParameter("sysparm_view", "approvalnotcategory1");
}
//PRB579164: Skip g_form creation in activities.xml if activities displayed in formatter
p.putParameter("sysparm_skip_gform", "true");
var rp = p.getRenderProperties();
rp.setSmallCaption(true);
rp.setInlinePopup(true);
rp.setReadOnly(false);
p.getPopup();
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 01:05 AM
Hi,
I have the same issue, but my requirement is if the change is approved already, I have to hide one field called "Classification" on approval summarizer.
I checked UI macros - approval summarizer is applicable on approval.
But don't know how to hide one field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 05:39 AM
I think you would have to create another view and then call that view based on different conditions. The following is untested and the view names/field values can differ for your instance. Its less of hiding a field and more like showing a different view based on values from fields in the source
if("${gr.state}"=="approved"){
<!-- make sure to include the Classification field on the view named approved -->
p.putParameter("sysparm_view", "approved");
<!-- if the state is anything else show another view -->
}else{
<!-- make sure to create another view in this case its named notapproved and do not include the field Classification on that view -->
p.putParameter("sysparm_view", "notapproved");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2017 09:56 AM
Hi Patrick,
Thank you for the quick help, I tried the same but its showing the view of else condition in all state.