- 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
01-09-2017 10:23 AM
it depends on what field you are using on the Change form to show where it is at in the change process.
you can try debugging and use the following in your code
gs.print("Test:"+"${gr.example_field}");
replace example_field with the field you are referring to in the if statement, then search the log for Test: to see what value is returning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2017 12:30 AM
Its not coming in logs Patrick, I think its not taking our if condition, gr.state is not taking the value of approval form