2

I'm new to integration with Netsuite. I've created a custom record and some fields along with values in Netsuite app, now I want to get those values from Webservice request. I'm getting labels, but I'm unable to get values.

CustomRecordType record = (CustomRecordType)response.getRecord();     
CustomRecordTypeFieldList fields = record.getCustomFieldList();     
CustomRecordCustomField[] crcf = fields.getCustomField(); 

for(CustomRecordCustomField c:crcf) 
{ 
    System.out.println(c.getLabel()); 
}
David Rogers
  • 2,601
  • 4
  • 39
  • 84
RvN
  • 133
  • 2
  • 5
  • 15

2 Answers2

1
customRec.setTypeId("626");
customRec.setInternalId("202"); 

ReadResponse response=_port.get(customRec);

CustomRecord record=(CustomRecord)response.getRecord();
CustomFieldList fields=record.getCustomFieldList();

CustomFieldRef[] crcf=fields.getCustomField();
int i=1;
Map<String,Object> test=new HashMap<String,Object>();
for(CustomFieldRef c:crcf)
{
    System.out.println(c.getScriptId());
    if(c instanceof StringCustomFieldRef)
    {
        test.put(p.getProperty(c.getScriptId()),((StringCustomFieldRef)c).getValue());
    }else if(c instanceof DateCustomFieldRef)
    {
        test.put(p.getProperty(c.getScriptId()),((DateCustomFieldRef)c).getValue().getTime());
    }
    else if(c instanceof LongCustomFieldRef)
    {
        test.put(p.getProperty(c.getScriptId()),((LongCustomFieldRef)c).getValue());
    }
    //System.out.println(c.getLabel()+" fieldtypes:  "+c.getFieldType().getValue());
i++;
}
for(Map.Entry<String,Object> entry:test.entrySet())
{
    System.out.println(entry.getKey()+"--->"+entry.getValue());
Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
0

This is C# or Java - not my strong ponit. However, after you load up the record, you should be able to do something like this:

record.fieldname

Suite Resources
  • 1,164
  • 8
  • 11