current.setvalue

Sneha39
Mega Guru

Table = u_test_table

Fields = field1, field2 

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('e2132865c0a8016500108d9cee411699');
var rc = cart.placeOrder(); 
var number = rc.number
//i want to set rc.number in field1 (BR on table u_test_table)
current.setValue(field1,number) ---- this is not working neither
1 ACCEPTED SOLUTION

Hi Neha,

your BR has different field name

current.setValue('u_field1',number);
current.update();

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Neha,

what type of field is this? where is this script written?

you should give the field name there

current.setValue('field1',number);

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

its not working. i want to copy rc.number in field and want to show field in response of api but its not getting copied.

Hi Neha,

are you getting the rc.number in logs? what type of business rule is this? Is this before BR?

Is the field name 'field1' correct?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yeah I am getting rc.number in logs and info message it just i am not able to set it in fiedl1 its passing empty value