This topic contains 1 reply, has 0 voices, and was last updated by JohnCCole 6 years, 6 months ago.

  • Author
    Posts
  • #17942

    vkwanengage

    Hi again,

    So i have this issue. I’m working with Sales Orders and within the Item sublist, i can pick Items with different types like: “Inventory_Item” or “Item_Group” or “Service_Item”. Now, if i go through the sublist and i retrieve the id of the Item, i was wondering if there was an easy way to determine the record Type of that Item? Currently i’m doing something like

    Get the record using type: Inventory_Item. If it is null, try getting the record using type: Item_Group. If it is null, try getting the record using type: Service_Item

    Not sure if there is a way to get an Item with just an ID and not specifying a type.

    Also i tried doing Record.Type on the sublist current line and it keeps returning me salesorder.

    Sorry if this is not so clear. Thanks in advance
    This is a cached copy. Click here to see the original post.

  • #17943

    JohnCCole

    One way is in your code you just have a hash matching the itemtype string to the record type string.

    Code:
    var itemRecordTypeLookup = {
    “InvtPart”:’inventoryitem”,
    “Service”:”serviceitem”
    };

    log.debug(‘Item Record Type’,itemRecordTypeLookup[“InvtPart”]) // Would debug print inventoryitem
    Another approach would be lookupField which would have the benefit of being flexible as new item types get introduced but for performance wouldn’t be so great.

    Code:
    var sItemType = search.lookupFields({type:’item’,id:’itemidfromsublist’,columns:’recordtype’})

You must be logged in to reply to this topic.