Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Custom Field Values Not Being Stored from Idea Portal

ShaidaC
Kilo Sage

Hi Community,

I am working on customizing the Idea Portal and have added some custom fields to the Create/Edit Idea widget.

ShaidaC_0-1786902624068.png

 

I have made the required changes to the widget and the values are being received correctly in the Scripted REST API. However, the custom field values are not being stored in their respective fields in the backend Idea table. While debugging, I found that the Create/Update process eventually calls the IMCreateEditIdeaDataServiceSNC Script Include. This is an OOB Script Include and is read-only, so I cannot directly modify it to map the additional custom fields.

 

What is the recommended OOB-supported approach to map and save these custom fields when creating an Idea? Can I extend or override IMCreateEditIdeaDataServiceSNC through the non-SNC Script Include, or is there another recommended extension point for adding custom field mappings without modifying the OOB read-only Script Include?

Any guidance on the correct approach would be greatly appreciated.

1 ACCEPTED SOLUTION

Anand__99
Mega Sage

Hi @ShaidaC ,

 

On response to your question to update the "IMCreateEditIdeaDataService" script include. 

Yes, you need to update this script include. The purpose of these type of script include is to override OOB methods without loosing future updates to the original script include.

 

Add your customised method (createIdea) to this script include. This way if you want to utilize the OOB script include later you can comment this and use OOB.

Test this end-to-end for any other idea table, make sure the changes does not affect any other portal/idea table.

 

If my response answered your query, please mark my response as correct/helpful.

Thanks
Anand

View solution in original post

8 REPLIES 8

glideFather
Tera Patron

ahoy @ShaidaC,

 

why have you used the scripted REST API? Do I understand it correctly that you want to have a value form the form on Idea Portal to be populated in the Idea [idea] table, is that right?

 

Also, if a script include is read-only, you can usually extend that script include to be able adding there some more scripting to it while the original version remains untouched.


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

Hi @glideFather , 

Yes, that is exactly what I am trying to achieve! I want the custom fields captured on the Idea Portal form to be populated in the Idea [idea] table.

My understanding of the OOB flow is that the Idea Portal widget collects the form data and passes it to the Scripted REST API, which then passes the data to the Script Include responsible for creating the Idea record. Because of this flow, I was initially thinking that modifying the Scripted REST API would be the appropriate place to make the required changes and pass the additional field values through.

Regarding the Script Include, I noticed the following OOB code in the Scripted Rest API:

var imCreateIdeaService =
    new IMCreateEditIdeaDataService(
        ideaInfo.ideaTable
    );

responseObj.ideaDetails =
    imCreateIdeaService.createIdea(
        ideaInfo
    );

From what I understand, IMCreateEditIdeaDataService extends the read-only IMCreateEditIdeaDataServiceSNC Script Include.

So, based on your suggestion, should I make my customizations in IMCreateEditIdeaDataService by overriding/extending the required methods, rather than modifying IMCreateEditIdeaDataServiceSNC?

 

Thanks!

ahoy @ShaidaC,

 

have you logged it to see what it passes/returnes?


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

Hi @glideFather ,

Yes, I was receiving data in the Scripted Rest API logs. The problem was the Script Include function.