Add Priority field in Idea Portal

Vikram3
Giga Guru

Hello Experts,

 

I wanted to add "Priority" field in Idea portal. I need to modify the "Create/Edit Idea" widget. Can someone help me with the code. Thanks in advance.

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Vikram3 

 

https://www.servicenow.com/community/developer-forum/idea-portal-widget-create-edit/m-p/2164477

 

https://www.servicenow.com/community/spm-forum/how-to-configure-new-idea-portal-fields-labels-and-cs...

 

https://www.servicenow.com/community/developer-forum/idea-portal-widget-im-create-edit-added-fields-...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Vikram3 

Hi @Vikram3 

 

https://www.servicenow.com/community/developer-forum/idea-portal-widget-create-edit/m-p/2164477

 

https://www.servicenow.com/community/spm-forum/how-to-configure-new-idea-portal-fields-labels-and-cs...

 

https://www.servicenow.com/community/developer-forum/idea-portal-widget-im-create-edit-added-fields-...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Rajdeep Ganguly
Mega Guru


Sure, here are the steps to add the "Priority" field in the "Create/Edit Idea" widget:

1. Navigate to Service Portal > Widgets in your ServiceNow instance.
2. Search for the "Create/Edit Idea" widget and open it.
3. In the widget's HTML template, you need to add a new field for "Priority". You can use the following code as a reference:

html

Priority

Select Priority

Priority is required.

 

 

4. In the widget's server script, you need to fetch the priority options from the server and add them to the data model. You can use the following code as a reference:

javascript
data.priorityOptions = [];
var priorityGR = new GlideRecord('incident_priority');
priorityGR.query();
while(priorityGR.next()) {
data.priorityOptions.push({
value: priorityGR.getValue('value'),
label: priorityGR.getDisplayValue('label')
});
}


5. In the widget's client script, you need to handle the priority field in the form submission. You can use the following code as a reference:

javascript
c.data.idea.priority = c.data.priorityOptions[0].value;
c.onSubmit = function() {
if(c.data.idea.priority == '') {
c.data.idea.priority.$invalid = true;
c.data.idea.priority.$pristine = false;
return;
}
c.server.update();
}


6. Save the widget and refresh the Service Portal to see the changes.

Please note that this is a basic example and you might need to adjust the code according to your specific requirements and ServiceNow setup.


nowKB.com

For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/

For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER