- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 12:53 AM
Hi ,
I am trying to insert record using GliderRecord in table chat_message but i am not able to set the To and From field.I haven't worked with Documnet ID type fields.
Can anyone please suggest how i can populate those document id field using Glide Record
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 01:19 AM
Hi Mukesh, the field is called to_id, so set current.to_id = sys_id. from_id is the name of the From field. You may also need to set the to_table and from_table with the name of the tables that the document is coming from as well, for instance:
current.to_id = incident.sys_id;
current.to_table = 'incident';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 02:10 AM
Hi Adam ,
Awesome solution, this resolved my issue.
I need one more help if any how you can advice, i am facing similar issue with chat_room table while i am trying to update the field Ref created by (ref_created_by) with another sys_id , it's not getting updated with new value via glide record.
Below is my code, can you suggest me what i am doing wrong here :
var chanRec = new GlideRecord('chat_room');
chanRec.addQuery('sys_id','fa5c5a5df12f7100328569e433ca694c');
chanRec.query();
if(chanRec.next()){
chanRec.ref_created_by = '9768443b2be3ad40b6b5756219da15da';
chanRec.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 02:18 AM
Great, glad I could help. I'm looking at your chat_room script and can't see too much wrong with it...
Where are your sys_id's coming from in this script? Sometimes I find that it's a good idea to cast object variables as string as I've had issues like that before:
if(chanRec.next()){
chanRec.ref_created_by = (String)'9768443b2be3ad40b6b5756219da15da';
chanRec.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 02:29 AM
I am using sys_id of my own profile from sys_user table.But it's not changing the field value despite being a reference field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 03:09 AM
Hi Adam ,
Did you got a chance to look in to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2015 03:20 AM
I am looking at this now and get the same issue. I'll update you when I work out why this is happening...