hi how is everyone, can you use record.submit fiel...
# suitescript
s
hi how is everyone, can you use record.submit fields to set the status of the transfer order to receive
s
did you try doing it with record.load instead? Are you sure the word "Received" is the value you need to set? I would think it's probably not
Also it does not really make sense to set the status of a transfer order to received; it's status is set to received by receiving the things on it. What do you expect to happen to the lines?
s
not really we use this for transfer orders we send to 3pl the button
and tyes i tried record.load also
n
I would think that the status value was not received as well. That would be the text though
TrnfrOrd:G
/`G` looks like the correct value
@Sim Greenbaum ☝️
s
@Nicholas Penree i didnt understand
Copy code
transferOrder.setValue({ fieldId: "status", value: "Received",ignoreFieldChange: true });
n
The value "Received" is not the correct value to pass in there
s
what sho0uld the value b e
n
"G"
You'll find a bunch of these cross references online
but the important part:
Copy code
Transfer Order:Received	TrnfrOrd:G
s
this is suite script 2.x
@Nicholas Penree
is your idea with record.load or record.submitfileds
n
@Sim Greenbaum yes this works in suitescript 1.x or 2.x - also for submitFields or record.load
s
Copy code
var Toid = ifRec.getValue({ fieldId: "createdfrom" });
    var id = record.submitFields({
      type: record.Type.TRANSFER_ORDER,
      id: Toid,
      values: {
        status: "G",
      },
      options: {
        enableSourcing: false,
        ignoreMandatoryFields: true,
      },
    });
what am i doing wrong ?
n
what error are you receiving?
s
non some context this is event is fire from a button on the item fulfillment
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(["N/record", "N/currentRecord", "N/ui/message"], /**
 * @param {record} record
 */ function (record, currentrecord, message) {
  function pageInit() {
    console.log("pageInit");
  }

  function _shipnow(sciptcontext) {
    var objRecord = currentrecord.get();
    var ifRec = record.load({
      type: objRecord.type,
      id: objRecord.id,
      isDynamic: false,
    });
    // ifRec.setValue({ fieldId: "shipstatus", value: "C" });
    // ifRec.save();
    // //document.location.reload();

    var Toid = ifRec.getValue({ fieldId: "createdfrom" });
    var id = record.submitFields({
      type: record.Type.TRANSFER_ORDER,
      id: Toid,
      values: {
        status: "G",
      },
      options: {
        enableSourcing: false,
        ignoreMandatoryFields: true,
      },
    });

    // var transferOrder = record.load({
    //   type: record.Type.TRANSFER_ORDER,
    //   id: Toid,
    //   isDynamic: false,
    // });

    // transferOrder.setValue({ fieldId: "status", value: "TrnfrOrd:G" });
    // var test2 = transferOrder.getValue({ fieldId: "status" });
    // console.log(test2);
    // transferOrder.save();

    var myMsg = message.create({
      title: "Action",
      message: "You transfer order was marked shipped and will be received.",
      type: message.Type.INFORMATION,
    });
    // will disappear after 5s
    myMsg.show({
      duration: 5000,
    });
    ///
    console.log("testing");
  }

  /// set time out

  return {
    pageInit: pageInit,
    shipnow: _shipnow,
  };
});
n
so your item fulfillments are created from transfer orders? when someone clicks a button on an IF you want to update the transfer order status to received?
s
yes
n
So I haven't worked with transfer orders specifically, we create our IFs from sales orders
but we mark the IF as shipped which in turn automatically updates the fulfilled/shipped qty on the sales order
s
sales order doesnt have a recived
n
right, it transitions to pending billing once we ship an IF
I'm assuming you need to create an item receipt when you receive an item?
the best I can tell from the docs is that you'd transform the transfer order into an item fulfillment and/or item receipt
i'm assuming once you create the receipt for the lines it would automatically update to received and the individual quantityReceived values on the lines would be populated like they are for shipments/IFs for us
s
yeah iam going to look itn it thanks
@Nicholas Penree thanks you where right i just need to transform the record
n
excellent 👍