- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 12:51 PM - edited 09-04-2024 01:16 PM
There is a field within the idea portal called "Idea Category".
I have a request to add the "Idea Category" field to the idea form "idea.do".
I need the value in the form to be equal to the selected "Idea Category" chosen during the idea creation within the portal.
Field "Idea Category" exists within the "im_m2m_idea_category" table.
Failed to accomplish this request using form layout, form design or form builder.
Any attempts to build many to many relationships or reference qualifiers have also ended in failure.
What is the correct way to accomplish this request?
Why is "Idea Category" not available as a dot walkable field within configure idea form?
Attempted So Far
- Create many to many relationship between table "im_m2m_idea_category" and table "idea"... add new value as reference value to form (this fails to actually fill the value with the selected category but does allow the user to select a new one).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 11:57 AM
Try this approach:
- Create a UI Macro named "idea_categories"
<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <!-- Get the categories --> <g2:evaluate var="jvar_categories" object="true"> var imIdeaCategory = new global.IMIdeaCategory(); var categories = imIdeaCategory.getCategoriesForIdea(current.getUniqueValue()); var categoryList = []; if (Array.isArray(categories)) { categories.forEach(function(category) { if (category.hasOwnProperty('name')) { categoryList.push(category.name); } }); } categoryList; </g2:evaluate> <!-- Display the categories --> <div class="idea-categories clearfix"> <div class="label_spacing"> <label dir="ltr" class="control-label col-xs-12 col-md-1_5 col-lg-2 col-xs-12 col-md-1_5 col-lg-2"> <span class="category-title">Categories</span> </label> </div> <div class="col-xs-10 col-md-9 col-lg-8"> <j2:forEach items="$[jvar_categories]" var="jvar_category"> <span class="category-badge">$[jvar_category]</span> </j2:forEach> </div> </div> <!-- Styles for the category buttons --> <style> .idea-categories { margin: 0 0 10px; } .category-badge{ color: #2e2e2e; background-color: #f5f5f5; padding: 5px 10px; display: inline-block; border: 1px solid #ddd; border-radius: 4px; margin-right: 5px; margin-bottom: 10px; } </style> </j:jelly>
- Create a UI Formatter (the value in "Formatter" must match the name of the UI Macro)
- Add the "Categories" formatter to the Idea form (probably under "Title")
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 08:26 AM
Hi @jacobspacek - Making the "Idea Category" field read-only in the platform (form/list views outside the Idea Portal) won’t eliminate the potential for updating a new idea up to five times. However, given that it's uncommon to see more than 10 new ideas in a day, the impact of performing multiple updates should be minimal.
That said, making the field read-only would simplify the design by eliminating the need to insert, update, or delete im_m2m_idea_category records. However, if you prefer to fully satisfy the request, which essentially requires a bi-directional sync, you could implement a business rule on the idea table to handle CRUD operations in im_m2m_idea_category when u_category changes.
One suggestion for consistency: consider labeling the field "Category" instead of "Idea Category," as that's how it appears in the Idea Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 10:46 AM
I should also mention, if you decide that you don't need to display the categories in lists—or do anything other than view them on the idea form—you could create a simple formatter like this:
Just keep in mind that you wouldn't be able to search or interact with the categories in any way, except for in the Idea Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 11:20 AM - edited 09-05-2024 11:20 AM
"or do anything other than view them on the idea form"
If we wanted to take this approach would creating a simple formatter accurately display the selected "Item Category" on the form?
If so any advice on how to incorporate that into the form would be awesome (form builder, layout etc).
No problem if the user can not modify or interact... just displaying the correct value on the form would be a big win!
THANK YOU SO MUCH for your assistance!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 11:57 AM
Try this approach:
- Create a UI Macro named "idea_categories"
<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <!-- Get the categories --> <g2:evaluate var="jvar_categories" object="true"> var imIdeaCategory = new global.IMIdeaCategory(); var categories = imIdeaCategory.getCategoriesForIdea(current.getUniqueValue()); var categoryList = []; if (Array.isArray(categories)) { categories.forEach(function(category) { if (category.hasOwnProperty('name')) { categoryList.push(category.name); } }); } categoryList; </g2:evaluate> <!-- Display the categories --> <div class="idea-categories clearfix"> <div class="label_spacing"> <label dir="ltr" class="control-label col-xs-12 col-md-1_5 col-lg-2 col-xs-12 col-md-1_5 col-lg-2"> <span class="category-title">Categories</span> </label> </div> <div class="col-xs-10 col-md-9 col-lg-8"> <j2:forEach items="$[jvar_categories]" var="jvar_category"> <span class="category-badge">$[jvar_category]</span> </j2:forEach> </div> </div> <!-- Styles for the category buttons --> <style> .idea-categories { margin: 0 0 10px; } .category-badge{ color: #2e2e2e; background-color: #f5f5f5; padding: 5px 10px; display: inline-block; border: 1px solid #ddd; border-radius: 4px; margin-right: 5px; margin-bottom: 10px; } </style> </j:jelly>
- Create a UI Formatter (the value in "Formatter" must match the name of the UI Macro)
- Add the "Categories" formatter to the Idea form (probably under "Title")
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 12:01 PM
I will give this a shot and let you know how it works!
As usual, thank you for such an awesome reply.