How to transform records in REST Webservices?

In REST web services, you can transform a record from one type into an another, using data from an existing records. For example, you can create an invoice record from an existing sales order record, using data from the sales order. All record transformations available in SuiteScript are available in REST web services, too. Transformations… Continue reading How to transform records in REST Webservices?

Transform sales order to item fulfillment

For a sales order with committed line items can be converted by setting default value as inventory location. Kindly refer to the transform code below. let trecord = record.transform({ fromType: “salesorder”, fromId: salesOrderId, toType: “itemfulfillment”, defaultValues: { ‘inventorylocation’: locationInternalId } }); If the sales order is uncommitted and the feature “Allow uncommitted” is enabled in… Continue reading Transform sales order to item fulfillment

Transforming transfer order based on item fulfillment

/** * * @param docNum * @param IFDetails * @param ifInternalId * @return {*|number} */ function IRcreation(docNum, IFDetails, ifInternalId) { try { let trecord = record.transform({ fromType: record.Type.TRANSFER_ORDER, fromId: docNum, toType: record.Type.ITEM_RECEIPT, isDynamic: true, defaultValues: {‘itemfulfillment’: ifInternalId.toString()} }); let itemCount = trecord.getLineCount({sublistId: ‘item’}); log.debug(‘in itemCount’, itemCount); for (let i = 0; i < itemCount; i++)… Continue reading Transforming transfer order based on item fulfillment