Set Domain of a record in UI Action

thisisauniqueus
Giga Expert

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

9 REPLIES 9

Abhinay Erra
Giga Sage

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'));


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


Abhinay Erra
Giga Sage

Can you post the ui action code here


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();