- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2017 01:29 AM
I need to set value to the field 'u_reserved_by'. Please help me how to get field value instead of sys_id for the below highlighted statement.
function onSubmit() {
g_form.setValue('approval', "Approved");
g_form.setValue('u_status', "Reserved");
var seatGR = new GlideRecord("u_all_seats");
seatGR.addQuery("sys_id", g_form.getValue('u_seat_number'));
seatGR.query();
while(seatGR.next())
{
seatGR.u_availability = "Reserved";
seatGR.u_reserved_by = g_form.getValue('u_name');
seatGR.update();
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2017 02:02 AM
You can use g_form.getDisplayValue('field name') or g_form.getDisplayBox('field name').value; to get the value of the field.
I prefer using g_form.getReference() method.
Kindly refer to the below code:
function onLoad() {
var b= g_form.getReference('requested_by',fan);
}
function fan(b)
{
var name=b.user_name;
alert(name);
}
the name captures the value of the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2017 06:45 AM
Thanks Harish,
Got it now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 01:47 PM
Hello Harish,
i need to set value , without sys_id for reference field .
actually i need to set attachment to attachment reference field depends on above choice list column.
please help me with this.
currently i am doing like
if(newValue == 'massive_kits_upload')
var temp=g_form.getLabelOf("Dinesh 123.xlsx");
g_form.setValue('temp1',temp);
alert(temp);
for this when i am saving record
when i am saving match not found is getting but , I have same attachment .
please help me with same, Thanks in Advance.
Regards,
RDK.