Hi everyone, assistance with suitescript code, try...
# general
c
Hi everyone, assistance with suitescript code, trying to fetch Subsidiary ID from a location record, though I'm getting the text name rather than number value. var locationLookup = search.lookupFields({ type: search.Type.LOCATION, id: locationId, columns: ['subsidiary'] }); subsidiaryName = locationLookup.subsidiary[0].value; locationLookup Debug: {"subsidiary":"Topco Inc"}
k
Copy code
var x = search.lookupFields({
        type: search.Type.LOCATION,
        id: 1,
        columns: ['subsidiary','internalid', 'name']
    });

var subsidiaryId = x['internalid'][0].value;

var subsidiaryName = x['subsidiary']
👎🏻 1
That worked for me.
c
@kenofthenorth thanks for trying, but didnt'work . it brings up the location internal id rather than sub id 😞
k
Ok, it looks like you can access these if your load them:
Copy code
var x = record.load({ type: 'location', id: 14 });
var subsidiaryId = x.getValue({ fieldId: 'subsidiary' });
1
c
worked tkx!