How to update user fields in User table for a particular user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2016 04:29 AM
How to update user details of user table(sys_user) from client scripting by passing sys_id of user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2016 04:49 AM
Hi Jason,
Please expand on what you are trying to do. Client scripts allow you to manipulate a form while it is visible to the user. It sounds like you may want use a business rule, but can't really help without more info.
Thanks
Conrad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2016 05:04 AM
I added 3 new fields (State, Contact, Session) to Incident and User Tables which refer to State table, Contract table, Session table.
Along with all out of box incident fields I added this 3 fields on to Incident form and insert this field values also.
I am able to add this 3 values into Incident table along with all the other values.
So at the time of creating the Incident I want to add the same 3 fields details into User table also.
How can I achieve it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2016 05:19 AM
Hi Jason,
So in order to update fields on another table (e.g sys_user) after you have written them to the incident table, you would use a Business rule to update the values for the user on the user table (see example below). Only question is why would you want to update these user fields for every incident? If a user logs multiple incidents you're just going to get a whole bunch of updates to the user table but not sure which one it should be, nevertheless below is how you would update it.
e.g
function updateUser(){
var gr = new GlideRecord('sys_user')
gr.addQuery('sys_user', current.caller_id);
gr.query();
if(gr,next()){
gr.u_state = current.u_state; //Replace u_state with your field names
gr.u_contract = current.u_contract; //Replace u_contract with your field names
gr.u_session = current.u_session; //Replace u_session with your field names
gr.update();
}
Thanks
Conrad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2016 05:33 AM
Hi Conradw,
Thank for the help.
I will need to add 3 field for the 1st time to user table and then on update the same with the details given in latest incident created for the same user, so that I can maintain the last selected details for those fields and populate the same when a User is selected again.