- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
2 hours ago - edited 2 hours ago
Requirement Overview:
I want to display the ideas that are submitted for a specific module on an idea portal.
Solution:
1. Download and install the sn_ppm_imd plugin
2. Navigate to Idea > Idea Module
Create a new Idea Module to separate idea portals
- Module Name: ex. Hardware
- Idea table: Idea[idea]
- Module Id: ex hardware
- Enable downvote: checked
- Active: checked
3. Navigate to Idea Category
- Create new Idea Category(Categories)
- Set the module to the new idea module
- Set the module to the new idea module
- Create new Idea Category Configurations that filter certain categories for each idea portal
- Category table: Idea Category[im_category]
- Category Field: Category name
- Parent Field: Parent
- Module: (new module)
- Filter:
- Active is true
- Module is (new module)
- Add new Module (Hardware Idea Portal)
- Input module in filter navigator and go to System Definition>Modules
- Create New module
- Link Type: URL (from Arguments:)
Arguments: /idea/?id=ideas_list&sysparm_module_id=hardware
Window Name: ex. Hardware Ideas
- If a new Record Producer is needed to submit development ideas through the Technology Service Portal
- Create a new Development Idea record producer (you can copy from Submit an Idea record producer)
- Update the script in the record producer to the new development idea module sys ID
-
This is needed so the new idea record will be tied to an idea module.
current.module = "5a89ac97c3823210d5511c377d013122"; // Sys_id of Hardware Module
5. Create a server callable script include
var InnovationUtils = Class.create();
InnovationUtils.prototype = {
initialize: function() {},
/****************************************************************************************
Description: Insert Business Rule for Idea record producer that creates a M2M association to the Idea & Category for Performance Analytics/Idea Portal
Parameters:
ideaSysId: Current Idea record Sys ID
categoryTable: Idea Category table
ideaCategoryTable: Idea/Category m2m relationship table
categorySysId: Sys IDs of selected idea category from record producer in String format
categoryArray: An array of the category Sys ID's
questionAnswerSysID: The idea record producer question variable (idea category)
categoryCount: System property for the amount of categories an idea can take, default 5
****************************************************************************************/
ideaInsert: function(ideaRec) {
var ideaSysId = ideaRec.sys_id;
var categoryTable = 'im_category';
var ideaCategoryTable = 'im_m2m_idea_category';
var categorySysId;
var categoryArray = [];
var questionAnswerSysID = '3237745bc3c23210d5511c377d013146';
// var categoryCount = gs.getProperty('idea.category.count');
var categoryAnswersGR = new GlideRecord('question_answer');
categoryAnswersGR.addQuery('table_sys_id', ideaSysId);
// queries idea record producer question variable (Idea Category)
categoryAnswersGR.addQuery('question', questionAnswerSysID);
categoryAnswersGR.query();
if (categoryAnswersGR.next()) {
// get string value for category sys ids
categorySysId = categoryAnswersGR.getValue('value');
// split them into array
categoryArray = categorySysId.split(',');
// create records in the M2M relationship table for up to 5 idea categories
for (i = 0; i < categoryArray.length && i < 5; i++) {
var ideaCategoryGR = new GlideRecord(ideaCategoryTable);
ideaCategoryGR.initialize();
ideaCategoryGR.setValue('idea', ideaSysId);
ideaCategoryGR.setValue('category_table', categoryTable);
ideaCategoryGR.setValue('category_id', categoryArray[i]);
ideaCategoryGR.insert();
}
}
},
type: 'InnovationUtils'
};
6. Create a after insert business rule on the Idea table
(function executeRule(current, previous /*null when async*/) {
var ideaUtils = new InnovationUtils();
ideaUtils.ideaInsert(current);
})(current, previous);
7. Create a record producer with the name Submit an Idea using the following variables:
- Title (Single line text)- Map to field - Title (idea table)
- Category (List Collector and reference to Idea Category table) - Map to field - custom List type Category field (idea table) -
- Description(HTML) - Map to field - Idea Descriptio (idea table)
8. Copy the sys_id of the Category variable on the record producer and paste it in the script include.
9. For redirection, use the following script inthe record producer script:
current.module = "5a89ac97c3823210d5511c377d013122"; // Sys_id of Hardware module
producer.portal_redirect = "idea?id=ideas_list&sysparm_module_id=hardware";
Result:
1. Open the Submit an Idea record producer.
2. Submit the Idea from the esc portal.
3. After submitting the idea from the esc portal, it will be redirected to the idea portal, where you will see only the Hardware module's ideas
If my article helped you, please mark it as helpful.
Thank you!
- 32 Views