Deluge help

Deluge help

Trying my hand at Deluge again & struggling with it, JavaScript syntax would be much easier ;-/

I'm having a problem getting a custom field value, can you point me in the right direction please guys ...

lineItems = salesorder.get("line_items").toList();
for each  lineItem in lineItems
{
name = lineItem.get("name");
if(name.contains(string))
{amount = lineItem.get( custom_field_name.value);}
}
info amount;