Not able to set value for a field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 03:10 AM
I was having a field called sub type where the field type is choice. The choice value has to get from the from the record producer variable i.e., inquiry. The value of variable and choice are same and also both the variable and choice label are also same. I have written the code in the record producer script to set the value of the sub type field but it was not getting updated.
Record producer script to set the value of the field is:
current.sub_type=producer.inquiry;
can anyone help me with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 04:06 AM - edited ‎04-05-2024 04:14 AM
Hi @Community Alums,
Hope you are doing well.
Proposed Solution
Kindly follow below points to rectify an issue: -
- Is there any error message you are able to see on your screen while submitting the record?
- If no, then while submitting the record, a new record is getting created without setting the value to that choice field. Confirm?
- Try to check the backed names of the variable "inquiry" and field "sub_type" are correct.
- Try to check whether you clicked on the "Map to Field" checkbox as checked in "inquiry" variable and map to the correct field "sub_type" of the table. If this checkbox is checked, then you even don't need to write the script, it'll map your variable to that field automatically.
If you find any information/knowledge/solution helpful, please don't forget to mark my solution and reply as helpful and accepted.
Thanks 🙂
Aakash Garg
ServiceNow Developer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 05:02 AM
1.Firstly i didnt see any error message
2.Verified the backend names are correctly mentioned
3.The field is consist of the choice which belongs to other dropdown so thats the reason trying to do that without using map to field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 04:10 AM
Why the script? If it's a record producer you can just map the fields on the inquiry variable (especially when the values are the same).
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark