Rushi Savarkar
Mega Sage
Mega Sage

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

  1. Module Name: ex. Hardware
  2. Idea table: Idea[idea]
  3. Module Id: ex hardware
  4. Enable downvote: checked
  5. Active: checked

3. Navigate to Idea Category

  1. Create new Idea Category(Categories)
    1. Set the module to the new idea module

      RushiSavarkar_0-1767183593639.png

  2. Create new Idea Category Configurations that filter certain categories for each idea portal
    1. Category table: Idea Category[im_category]
    2. Category Field: Category name
    3. Parent Field: Parent
    4. Module: (new module)
    5. Filter:
      •  Active is true
      •  Module is (new module)
  3. Add new Module (Hardware Idea Portal)
    1. Input module in filter navigator and go to System Definition>Modules
    2. Create New module
    3. Link Type: URL (from Arguments:)
      Arguments: /idea/?id=ideas_list&sysparm_module_id=hardware
      Window Name: ex. Hardware Ideas
    4. RushiSavarkar_2-1767184004862.png
  4. If a new Record Producer is needed to submit development ideas through the Technology Service Portal
    1. Create a new Development Idea record producer (you can copy from Submit an Idea record producer)
    2. Update the script in the record producer to the new development idea module sys ID
    3. 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!

Version history
Last update:
2 hours ago
Updated by:
Contributors