Set Domain of a record in UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 12:26 PM
Hi
I am creating a Demand record from Problem on click of an UI Action. The issue is the resulting demand record is created in the default domain always, where as i want it to be created in the customer domain. In the script i have something like
...
demand.setValue("sys_domain", current.sys_domain.sys_id);
demand.setValue("u_affected_domain", current.u_affected_domain);
...
where current problem record is in the customer domain.
Please guide me what im missing here
Regards
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 12:31 PM
In the client side, current object is not define. Post your entire code of the UI action. Try this
demand.setValue("sys_domain", g_form.getValue('sys_domain'));
demand.setValue("u_affected_domain", g_form.getValue('.u_affected_domain'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 01:23 PM
Thanks Abhinay for your time. In a UI Action im not using the client function the current object is available as other field values are being set correctly
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 01:31 PM
Can you post the ui action code here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 01:55 PM
var demand = new GlideRecord("dmn_demand");
demand.setValue("sys_domain", current.sys_domain.sys_id);
demand.setValue("u_affected_domain", current.u_affected_domain);
demand.priority = current.priority;
demand.insert();