Nilesh Patil
06/23/2022, 2:57 PMpen one
06/23/2022, 7:00 PMMike Robbins
06/23/2022, 8:30 PMcontext.newRecord.getValue({ fieldId: 'customform' })
return undefined
in the beforeLoad
on a view event of a Sales Order?
I was seeing the same thing in a workflow where the action to add a button based on the form would log customform
was not a valid field.JL
06/24/2022, 12:04 PMscrenshaw
06/24/2022, 12:25 PMMoCheeks
06/24/2022, 3:39 PMburkybang
06/24/2022, 4:58 PM['10/1/2022', '10/31/2022']
Suitegirl_net
06/24/2022, 5:05 PMjen
06/24/2022, 10:23 PMrequire
and as such, the script is loaded afresh and the value of the global variable is reset.suiteExperimenter
06/25/2022, 5:23 AMGail Kasnett
06/26/2022, 10:36 AMfor (il = 0; il < items_by_location.length; il++) {
var item_loc = ''
item_loc = items_by_location[il]
if (item_loc.location == loc) {
loc_items.push(item_loc)
}
}
log.debug('total location items: ' + loc_items.length)
if (loc_items.length == 0) { continue }
log.debug('loc_items: ', loc_items)
// var fulfillment = ''
//transform SO to create a new Item fulfillment
// try {
var fulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: sales_order.id,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});
log.debug('got past transform')
// } catch (err) {
// var subj = 'Failed to transform ' + transaction_id + ' to IF'
// var msg = err.message
// sendEmail_forceSenderReceiver(subj, msg)
// }
log.debug('fulfillment', fulfillment)
//get line count of newly created fulfillment
var lineCount = fulfillment.getLineCount('item');
log.debug('fulfillment line count', lineCount)
for (li = 0; li < loc_items.length; li++) {
var loc_item = loc_items[li]
log.debug('loc_item', loc_item)
if (loc_item.committedQty < loc_item.qty) {
log.debug(loc.item_name + ' is on BackOrder. Not Creating fulfillment for these items')
email_message += '</ br> Sales Order: ' + sales_order.id + ', Location: ' + loc + ' not creating an IF right now because ' + loc_item.item_name + ' is on backorder.'
break
}
//for each line set the "itemreceive" field to true
for (var i = 0; i < lineCount; i++) {
log.debug('i in lineCount: ', i)
var prod_id = fulfillment.getSublistValue({
sublistId: 'item',
fieldId: 'item',
line: i
})
log.debug('Item Name: ', prod_id)
fulfillment.selectLine({
sublistId: 'item',
line: i
});
// let items_location = loc_items.map(a => a.item_id);
var items_location = []
for (ll = 0; ll < loc_items.length; ll++) {
log.debug(ll + ': itemID: ' + loc_items[ll].item_id)
items_location.push(loc_items[ll].item_id)
}
if (!items_location.includes(prod_id)) {
continue;
}
log.debug('setting items to add')
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
value: true
});
fulfillment.commitLine({
sublistId: 'item'
});
log.debug('commited')
} //looping through line items in the SO
} //loop of location items
var ful_id = fulfillment.save({ ignoreMandatoryFields: true })
Marwan
06/26/2022, 6:55 PMid
action
json_body
status
error
and one RESTlet to receive everything, that will just save the requests to that record.
Then, with a scheduled script, we loop over them, and call the RESTlets with the JSON bodies.
What do you think?c c
06/27/2022, 7:59 AMSINDHU REDDY
06/27/2022, 10:47 AMMichael Scott
06/27/2022, 11:25 AMLivio
06/27/2022, 1:56 PMNElliott
06/27/2022, 2:36 PMJessicaL
06/27/2022, 3:19 PMLogan Ickert
06/27/2022, 3:29 PM{ id: 'scripttopop',
label: 'Script to populate canvas',
type: serverWidget.FieldType.INLINEHTML,
breakType: serverWidget.FieldBreakType.STARTROW,
layoutType: serverWidget.FieldLayoutType.OUTSIDEBELOW,
`defaultValue: `<canvas id="mychart" width="100px" height="50px></canvas><script type="text/javascript" src="url in the file cab for the chartjs lib">const myChart = new Chart(document.getElementById('mychart'),${config});</script>``
}
If someone could either help me figure out why this isn't rendering, or point me in the direction of a different lib that would be great!ericbirdsall
06/27/2022, 3:46 PMrazer456
06/27/2022, 6:05 PMCory Weiner
06/27/2022, 7:19 PMwsangster
06/27/2022, 7:58 PMvar createSaveSearch = search.create({
type: "customer",
filters:
[
["isinactive","is","F"],
"AND",
["internalid","anyof","11980"]
],
columns:
[
search.createColumn({name: "internalid", label: "Internal ID"}),
search.createColumn({name: "entityid", join: "contact", label: "Name"})
]
})
It's not bringing back the contact names.Michael Scott
06/27/2022, 10:24 PMMarvin
06/28/2022, 12:12 AMconst preferred_vendor_line = itemRecord.findSublistLineWithValue({
sublistId: 'itemvendor',
fieldId: 'preferredvendor',
value: true
});
itemRecord.setSublistValue({
sublistId: 'itemvendor',
fieldId: 'purchaseprice',
line: preferred_vendor_line,
value: parseFloat(price || '0').toFixed(2)
});
itemRecord.save({
ignoreMandatoryFields: true
});
Yvonne
06/28/2022, 5:43 AMraghav
06/28/2022, 7:31 AMsholodnick
06/28/2022, 4:08 PMMicah
06/28/2022, 5:26 PM/**
* @NApiVersion 2.x
* @NScriptType ScheduledScript
*/
define(['N/search','N/record'], function (s,r) {
function execute(context) {
var approvalSearch = s.load({
id: 'customsearch_to_tbreceived'
});
var resultSet = approvalSearch.run();
resultSet.each(processTransferOrder);
};
function processTransferOrder(result){
var internalID = result.getValue(result.columns[0]);
log.debug({title:'InternalID',details:internalID});
var record = r.load({
type:'transferorder',
id:internalID
});
var irRecord = r.transform({
fromType: 'transferorder',
fromId: internalID,
toType: 'itemreceipt'
});
var itemCount = irRecord.getLineCount('item');
for (var i = 0; i < itemCount; i++){
var itemId = irRecord.getSublistValue('item','item',i);
var quantity = irRecord.getSublistValue('item','quantity',i);
var lineId = irRecord.getSublistValue('item','line',i);
var location = irRecord.getSublistValue('item','location',i);
log.debug({
title:'Item - Quantity - LineId - Location',
details:itemId + ' - ' + quantity + ' - ' + lineId + ' - ' + location
});
irRecord.setSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
line: lineId,
value:true
});
}
var idl = irRecord.save({
enableSourcing: true
});
return true;
};
return({
execute:execute
});
});
When it runs, it gives the following error:
{
"type": "error.SuiteScriptError",
"name": "UNEXPECTED_ERROR",
"message": null,
"stack": [
"anonymous(N/serverRecordService)",
"processTransferOrder(/SuiteScripts/bb_auto_receive_to.js:39)",
"each(N/searchObject)",
"execute(/SuiteScripts/bb_auto_receive_to.js:11)"
],
"cause": {
"type": "internal error",
"code": "UNEXPECTED_ERROR",
"details": null,
"userEvent": null,
"stackTrace": [
"anonymous(N/serverRecordService)",
"processTransferOrder(/SuiteScripts/bb_auto_receive_to.js:39)",
"each(N/searchObject)",
"execute(/SuiteScripts/bb_auto_receive_to.js:11)"
],
"notifyOff": false
},
"id": "853f25fd-e6ab-452a-9ffb-13ced90c4b5c-2d323032322e30362e3238",
"notifyOff": false,
"userFacing": false
}
It gives this error on line 39 on the 2nd iteration through the items. Anyone see what I am doing wrong?Sim Greenbaum
06/28/2022, 6:52 PMpackagingusps