How to call Business rule in Ui action?

Ashwini Jadhao
Giga Guru

Hi,

How to fire Business Rule in UI action to create child tables record. After clicking the Ui action The state changes properly but I am not able to fire the BR to Create child tables records.

Once the records get created The another ui action should be visible.

Thank you.

7 REPLIES 7

Devyani_6
Mega Guru

Hi Ash,

Can you paste your code here to get things clear.

Below threads have same requirement, have a look on below threads also.

UI Action to Create Record in Another Table.

Create a new UI Action to create a new record

Mark Correct/Helpful, based on impact of response.

Regards,

Devyani

www.dxsherpa.com

Soumita3
Tera Expert

Hi Ash,

 

I hope this help:

 

https://community.servicenow.com/community?id=community_question&sys_id=6367023adb2867c0fece0b55ca961921

 

 

Please mark the answer as correct/helpful if it suffice your query.

 

Thanks.
Soumita.

Ashwini Jadhao
Giga Guru

Hi Devyani,

I had just write the code to change the state after clicking the Ui action. I am not able to fire BR to create child tales record.

function onClick(){

if(g_form.getValue('state') != 'discuss')
{
g_form.setValue('state',"discuss");
//alert('state changes to discuss');
}
gsftSubmit(null, g_form.getFormElement(), 'createDiscussion');
}
if (typeof window == 'undefined')
serverDiscussion();

function serverDiscussion(){

current.state = 'discuss';
current.update();
}

Ashwini Jadhao
Giga Guru

code to create the discussion record without firing the Business Rule

function onClick(){

if(g_form.getValue('state') != 'add')
{
g_form.setValue('state',"add");
//alert('state changes to add');
}
gsftSubmit(null, g_form.getFormElement(), 'createadd');
}
if (typeof window == 'undefined')
serverAdd();

function serverAdd(){
current.state = 'add';
current.update();
var disc = new GlideRecord('x_256866_outlier_r_add');
disc.evaluation=current.number;
disc.state ='new';
disc.property=current.property;
disc.insert();
disc.update();

}

 

evaluation field not populated with the current record number.