how to set value for string field having choices using fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2022 02:39 AM
I want to insert a record with fiscal year field value, on form it is choice field but in backend it's a string
tableRec = new GlideRecord('cost_plan');
tableRec.initialize();
tableRec.name = 'Test costplan4';
tableRec.task = 'ff80cc231bb3f89c2473eb19b04bcb43';
tableRec.u_fiscal_year = 'FY-22/23'; // if am giving direct choice value it is coming in blue color
OR
tableRec.u_fiscal_year = 'af36cf62dbad9c509a88b1b239961937'; //if am giving sys_id of (FY-22/23) then sys_id is coming in the field.
tableRec.insert();
What is the correct method to insert choice from choice list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2025 05:20 AM
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader