- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2023 05:51 AM
I want to show total number of comments on the idea portal for each idea. and also when click on comments then go the comments section.
Just like i want I am attaching the picture.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2023 11:59 AM
Hi @RushiM :
I created the functionality using those steps:
Step 1: Go to the Script Include "IMCommonService" and change the "getIdeaInfo" function for this :
IMCommonService.getIdeaInfo = function(ideaGr, isAttachmentsInfoRequired) {
var _ideaInfo = {};
var commentNumber = 0; //Return the number of commet
var comments = new GlideRecord("cf_comment");
comments.addQuery("source", ideaGr.getValue('sys_id'));
comments.query();
while(comments.next()){
commentNumber ++;
}
if(ideaGr.isValidRecord() && ideaGr.canRead()) {
_ideaInfo = {
commentNumber: commentNumber,
sysId: ideaGr.getValue('sys_id'),
title: ideaGr.short_description.getDisplayValue(),
description: ideaGr.idea_description.getDisplayValue(),
submittedBy: ideaGr.getValue('submitter'),
submittedByDv: ideaGr.getDisplayValue('submitter'),
stateDv : ideaGr.getDisplayValue('state'),
state : ideaGr.getValue('state'),
score : ideaGr.getValue('score'),
createdOn: ideaGr.getValue('sys_created_on'),
updatedOn: ideaGr.getValue('sys_updated_on'),
isActive: (ideaGr.getValue('active') === "1"),
ideaTable: ideaGr.getValue('sys_class_name'),
viewsCount: IMCommonService.getViewCount('im_idea_core', ideaGr.getValue('sys_id'), 'view_count'),
isIdeaAdmin: gs.hasRole('idea_admin'),
isIdeaManager: gs.hasRole('idea_manager'),
isValid: true,
canDelete: ideaGr.canDelete()
};
_ideaInfo.canVoteForIdea = ideaGr.getValue('submitter') != gs.getUserID() && _ideaInfo.isActive;
if(!_ideaInfo.isActive) {
_ideaInfo.closedOn = ideaGr.getValue('closed_at');
_ideaInfo.closedBy = ideaGr.getValue('closed_by');
_ideaInfo.closedNotes = ideaGr.getDisplayValue('close_notes');
_ideaInfo.closedByInfo = IMCommonService.getUserInfoFromId(_ideaInfo.closedBy);
}
if(isAttachmentsInfoRequired)
_ideaInfo.attachmentsData = IMCommonService.getAttachmentsForIdea(_ideaInfo.sysId, _ideaInfo.ideaTable);
if(ideaGr.getValue('state') == '8' && ideaGr.getValue('duplicate')) {
_ideaInfo.isDuplicate = true;
_ideaInfo.duplicateIdea = {
sysId: ideaGr.getValue('duplicate'),
title: ideaGr.duplicate.getRefRecord().getDisplayValue('short_description')
};
}
}
return _ideaInfo;
};
Step 2: Go to the "IM Ideas" 'im_ideas_list' Widget and add that Part between the Created and state item:
<span class="idea-separator-dot h3" aria-hidden="true">·</span>
<span>
{{::idea.commentNumber}} Comments
</span>
Then you can test, the part of to link to the comment section you can create that part or just link to the same record using :
<a class="idea-heading --primary"
im-highlight-text="{{data.searchTerm}}"
ng-href="?id=view_idea&sysparm_idea_id={{::idea.sysId}}&sysparm_idea_table={{::data.ideaTable}}&sysparm_module_id={{::data.moduleId}}"
role="link">
{{::idea.commentNumber}} Comments
</a>
The functionality work for me, i will pass the update set:
Hope That Help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2023 11:59 AM
Hi @RushiM :
I created the functionality using those steps:
Step 1: Go to the Script Include "IMCommonService" and change the "getIdeaInfo" function for this :
IMCommonService.getIdeaInfo = function(ideaGr, isAttachmentsInfoRequired) {
var _ideaInfo = {};
var commentNumber = 0; //Return the number of commet
var comments = new GlideRecord("cf_comment");
comments.addQuery("source", ideaGr.getValue('sys_id'));
comments.query();
while(comments.next()){
commentNumber ++;
}
if(ideaGr.isValidRecord() && ideaGr.canRead()) {
_ideaInfo = {
commentNumber: commentNumber,
sysId: ideaGr.getValue('sys_id'),
title: ideaGr.short_description.getDisplayValue(),
description: ideaGr.idea_description.getDisplayValue(),
submittedBy: ideaGr.getValue('submitter'),
submittedByDv: ideaGr.getDisplayValue('submitter'),
stateDv : ideaGr.getDisplayValue('state'),
state : ideaGr.getValue('state'),
score : ideaGr.getValue('score'),
createdOn: ideaGr.getValue('sys_created_on'),
updatedOn: ideaGr.getValue('sys_updated_on'),
isActive: (ideaGr.getValue('active') === "1"),
ideaTable: ideaGr.getValue('sys_class_name'),
viewsCount: IMCommonService.getViewCount('im_idea_core', ideaGr.getValue('sys_id'), 'view_count'),
isIdeaAdmin: gs.hasRole('idea_admin'),
isIdeaManager: gs.hasRole('idea_manager'),
isValid: true,
canDelete: ideaGr.canDelete()
};
_ideaInfo.canVoteForIdea = ideaGr.getValue('submitter') != gs.getUserID() && _ideaInfo.isActive;
if(!_ideaInfo.isActive) {
_ideaInfo.closedOn = ideaGr.getValue('closed_at');
_ideaInfo.closedBy = ideaGr.getValue('closed_by');
_ideaInfo.closedNotes = ideaGr.getDisplayValue('close_notes');
_ideaInfo.closedByInfo = IMCommonService.getUserInfoFromId(_ideaInfo.closedBy);
}
if(isAttachmentsInfoRequired)
_ideaInfo.attachmentsData = IMCommonService.getAttachmentsForIdea(_ideaInfo.sysId, _ideaInfo.ideaTable);
if(ideaGr.getValue('state') == '8' && ideaGr.getValue('duplicate')) {
_ideaInfo.isDuplicate = true;
_ideaInfo.duplicateIdea = {
sysId: ideaGr.getValue('duplicate'),
title: ideaGr.duplicate.getRefRecord().getDisplayValue('short_description')
};
}
}
return _ideaInfo;
};
Step 2: Go to the "IM Ideas" 'im_ideas_list' Widget and add that Part between the Created and state item:
<span class="idea-separator-dot h3" aria-hidden="true">·</span>
<span>
{{::idea.commentNumber}} Comments
</span>
Then you can test, the part of to link to the comment section you can create that part or just link to the same record using :
<a class="idea-heading --primary"
im-highlight-text="{{data.searchTerm}}"
ng-href="?id=view_idea&sysparm_idea_id={{::idea.sysId}}&sysparm_idea_table={{::data.ideaTable}}&sysparm_module_id={{::data.moduleId}}"
role="link">
{{::idea.commentNumber}} Comments
</a>
The functionality work for me, i will pass the update set:
Hope That Help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2023 12:51 AM
Thank you @Marco0o1, for this solution. It works for me.