The CreatorCon Call for Content is officially open! Get started here.

How to Access Elements in Form's Embedded List with JavaScript?

lmcmanamon
Giga Contributor

Hello All!

I'm new to using ServiceNow and trying to brush up on my JavaScript. I'm encountering a small issue with not knowing how to access certain elements on my form. Basically, as you can see from the screencap, I have a variety of fields that are of data type "Decimal" in my Product Table Embedded List. I'd like to have it so that the summation of all those fields is put into the "Total Dealer Cost" field. Below is a screencap of both my form and my current Client Script for just when the Admin field is edited. For the script, it alerts that onCellEdit has been entered and that findTotalDealerCost has been entered, so fails when I try to access the Admin field. Could someone point me in the right direction?

Rep Support Form:

Rep Support Form.PNG

Client Script:

Client Script.PNG

11 REPLIES 11

just write this in calculation block



current.admin+current.insurance+current.reserves+current.overfunds+current.thirdPartyFees+current.associationFee+current.fakePack+current.other



And actually this will also not work as the field names(admin, insurance etc) are wrong, these clearly look like user defined fields and its name would start with u_


-Anurag

Hi



I tested it, an onChange Script with getDecimalValue is working