I am in the process of writing a script to return a customers last transaction. As part of the Transaction there are two child records being included, 'item' and a custom record 'custrecord1' which is joined by field 'custbody2'.
as part of the columns required in the return I need the interalid for both 'item' and 'custrecord1'. However which ever records field 'internalid' is added last, that is the once that is returned.
Here are two code samples and data returned. Key Fields are Bolden
Sample A:
var columns = new Array( new nlobjSearchColumn("tranid",null), new nlobjSearchColumn("trandate",null, null), new nlobjSearchColumn("custbody7"), new nlobjSearchColumn("memo"), // Fields for custrecord1 <strong>new nlobjSearchColumn("internalid","custbody2", null),</strong> new nlobjSearchColumn("name","custbody2", null), new nlobjSearchColumn("custrecord27","custbody2", null), // Item Fields new nlobjSearchColumn("itemid","item", null), <strong>new nlobjSearchColumn("internalid", "item", null),</strong> new nlobjSearchColumn("class","item"), new nlobjSearchColumn("custitem_itemtype","item") );
[FONT=arial]
Data Sample Return:[/FONT] [LEFT]
{"id":"390814","recordtype":"salesorder","columns" :{"tranid":"23182","trandate":"5/19/2015","custbody7":{"name":"Summer 2015","internalid":"16"},"internalid":{"name":"803","internalid":"803"},"name":"Abigail","custrecord27":"Schultz","itemid ":"Extended Care Ranch PM Week 10","class":{"name":"Ranch","internalid":"46"}}}[/LEFT]
Sample B:var columns = new Array( new nlobjSearchColumn("tranid",null), new nlobjSearchColumn("trandate",null, null), new nlobjSearchColumn("custbody7"), new nlobjSearchColumn("memo"), // Item Fields <strong>new nlobjSearchColumn("internalid", "item", null),</strong> new nlobjSearchColumn("class","item"), new nlobjSearchColumn("custitem_itemtype","item"), // Fields for custrecord1 <strong>new nlobjSearchColumn("internalid","custbody2", null),</strong> new nlobjSearchColumn("name","custbody2", null), new nlobjSearchColumn("custrecord27","custbody2", null), new nlobjSearchColumn("itemid","item", null) );
[FONT=arial]Data Sample Return:[/FONT] [LEFT]
{"id":"390814","recordtype":"salesorder","columns" :{"tranid":"23182","trandate":"5/19/2015","custbody7":{"name":"Summer 2015","internalid":"16"},"itemid":"Extended Care Ranch PM Week 10","internalid":{"name":"14188","internalid":"141 88"},"class":{"name":"Ranch","internalid":"46"},"name" :"Abigail","custrecord27":"Schultz"}}[/LEFT]
[FONT=arial]Any input on how to get the internalId for both item and custrecord1 is appreciated.[/FONT]