- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi All
Can someone please help me with my Flow designer action script below which is to update a field value based on the field name entered as the "field" input .
My use case is that I have a record producer and the variables are mapped to the record fields. If the value on the record is changed, then Flow designer correctly updates the associated variable.
I want the ability that if the variable is changed, then it updates the mapped field. I have created a flow that looks up the mapped field of the variable question, which will then return the field name i,.e "u_accident".
This field name is then one of the inputs on my script called "field". I then want the script to be able to update that field on the record, but my script is not able to recognise:-
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
try this syntax
user[inputs.field] = inputs.value;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
try this syntax
user[inputs.field] = inputs.value;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
@jonathangilbert
Please try following scripts.
(function execute(inputs, outputs) {
var user = new GlideRecord(inputs.tablename);
user.addQuery('sys_id',inputs.sys_id1);
user.query();
while(user.next()){
user.setValue(inputs.field) = inputs.value;//script should update the field that was entered as the input .ie "u_accident"
user.update();
}})(inputs, outputs);