Passing sys id from BR to Script include

Inya
Tera Contributor

Hi Team,

I have a clarification that am putting forth to our expert snow family.

So, i have a Business rule and am calling a Script Include from BR.

Will current.sys_id work on SI for further usage without even passing the current object to BR on the function call.

 

Note  - I did this, and seems to be working fine, i passed current.sys_id , on the SI function, say callingSI(current.sys_id).

Now on SI , i have it like this callingSI(){

//still accessing current.sys_id

var gr=new GlideRecord('talename');

gr.addQuery('sys_id',current.sys_id);

---

---

}

Will this work.

Thanks,

Iniya

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hello Inya,

Since you are calling SI from BR, the SI instantiated in the BR itself and hence current will be available in the SI.

Mark the comment as a correct answer and helpful if it answers your question.

View solution in original post

8 REPLIES 8

Mike Patel
Tera Sage

you can do something like below

Business Rule:

new callingSI(current.sys_id);

SI:

callingSI(sysid){

//still accessing current.sys_id

var gr=new GlideRecord('talename');

gr.addQuery('sys_id', sysid);

---

---

}

 

you can also do below

Business Rule:

new callingSI(current);

SI:

callingSI(gr){

 

gs.print(gr.number);

Inya
Tera Contributor

Hi Mike Patel,

Thanks for your response.

Actually even though am passing the current.sys_id on BR, but in SI i fail to get that through function, instead i directly start using on SI as current.sys_id and still seeem to work fine far, but was worried if its right.

 

 I do this :

new callingSI(current.sys_id);

SI:

callingSI(<empty>){

//still accessing current.sys_id

var gr=new GlideRecord('talename');

gr.addQuery('sys_id', current.sysid);

 

Thanks,

Iniya

 

 

Best practice is to use variable instead of current like I mentioned in my script.

amol_joshi
Tera Contributor

For me the current.getUniqueValue() worked perfectly.