Has anyone had any luck getting the expected ship ...
# general
n
Has anyone had any luck getting the expected ship date (or any date field) to calculate on a sales order transaction, ideally after user edit of the item field. (or maybe after field source) I need to effectively add the lead time field (this comes through to the line of the transaction) and add it to the current date. I can get expected ship date to populate IF i dont perform a calculation but as soon as i add a number it stuffs up. I have tried a f=ew various combos of _char and to date with no luck. My use case is literally that the user wants the expected ship date to populate with the default lead time for the item (today + days off the item) it doesnt need to do any stock or anything. I tested this and it doesnt work either 9but i think its because the date format is DD/MM/YYYY. note i tried just using {today} in the formula and its blank. I tried to_date as well but perhaps i have it wrong. I think the issue is getting the field code in the formula to go in the right format and the output, but i cant quite figure out the issue. if anyone has achieved anything similar, oi would love if you an let me know. Heeds to be on after field edit ideally as this needs to populate as soon as the user keys the item.
I can also get it to set if i just use date and then set to day today or tomorrow or next week through that, but i need this to set to {today} + lead time (lead time is in a custom field on the line of the transaction)
After much trial and error and checking suite answers for numerous responses, i found this one that helped get me in the right direction (solution 2) https://suiteanswers.custhelp.com/app/answers/detail/a_id/87829/loc/en_US nlapiDateToString(nlapiAddDays(nlapiStringToDate(nlapiGetFieldValue('trandate')), parseInt(nlapiGetLineItemValue('item', 'custcol_default_lead_time', line))), 'date') i feel like am maybe close but stuck at how to proceed. I also tried nlapiDateToString(nlapiAddDays(nlapiStringToDate(nlapiGetFieldValue('trandate')), parseInt(nlapiGetLineItemValue('item', 'custcol_default_lead_time', line))), 'DD/MM/YYYY') The error i am getting is "Invalid date value (must be DD/MM/YYYY)" I did find another suite answer to indicate that DD/MM/YYYY format in the preferences may not be compatible with this i am really hoping there is another way as we need to avid getting a script for this. surely it it is possible with a workflow?) Customer account preferences are DD/MM/YYYY (we are in Australia so this is the correct format for this country) https://suiteanswers.custhelp.com/app/answers/detail/a_id/23304/loc/en_US If i do not use a custom field for the lead time and instead use a hard coded number (ie 30) then the above works. So it only mucks up when i add the custom field.
Copy code
The last part of this is i actually need to source "Today"s date when doing this, not trandate, but i wanted to solve lead time part first, but if anyone can help with both that would be awesome.
So i found a solution although not very elegant or scalable will do the job for now. Created a custom field on the item record to calculate their default lead time + today as a non stored field and then sourced that field to the sales order, it works which is the main thing. Ultimately the client needs a kind of complex solution that needs some work done around it so this gets them in no worse state than they are currently which is good.
110 Views