How to get the NAME of a sc_req_item variable via a business rule ...

Zod
Giga Guru

Hi,

I need to get the NAME of the variable of a requested item ... .

The BR runs on the sc_req_item table after insert ... but I'm not able to access the NAME of the variable. 

If I WOULD have the name of the variable I could access it via gs.info(current.varriable.testvariable) what would show the VALUE of the Variabler (not the sys_id) ... 

But what I need the the NAME of the variable that has been requested ... .

Currently it looks to me like I would have to check a bunch of tables like 

sc_item_option_mtom > sc_item_option > item_option_new ... to finally getting the name of the variable ...

 

Is there not more easy way???

7 REPLIES 7

This is not the issue!

 

I do not KNOW THE FIELD NAME! ... so 

gs.log(current.variables[field]);  ... WILL NOT WORK AS I DO NOT HAVE IT at this point in time... .

 

But is ok. No further help required on this a I somehow solved it otherwise ... 

gs.log(field); //gives you the variable name of each variables in loop

 

Here, field is not the field name.

it's just the temp variable used for for loop.

 

You don't need variable names to be known.

That's why I mentioned try it in server script.

 

Anyhow you have found the answer.

 

 

Aziz GUEYE
Tera Contributor

Use this alternative

g_form.setValue("variable_name", []);

Please check and let me know if still facing the issue.