Netsuite - Compare dates in saved search (system notes) - netsuite

Example and background: Netsuite sets "Printed picking ticket" = "TRUE" when the picking ticket is printed on order X. The item fulfillment is only a partial delivery, "Printed picking ticket" is then turned back to "FALSE" on order X. Not great, since we would like to see printed quantity per orderline, but that's another issue. Picking ticket for order X is then printed again, but this time with 0 quantites commited, Netsuite sets "Printed picking ticket" = "TRUE" again, even though the picking ticket didn't contain any items.
When the back ordered items are being received, the "Printed picking ticket"-flag is not turned back to "FALSE" - meaning that it looks like it has been printed even though it's not. This is by design and a big flaw in my opinion.
One workaround could be to prevent users from printing empty picking tickets, but that's easier said than done.
I would like to create a saved search for all those orders, i.e. 1. printed empty picking ticket and 2. we receive goods.
For that, I need to go with the system notes. This is how I want the saved search to work:
Standard criteria:
Type = Sales order
Item type in (Assembly, Inventory Item)
Main line, Shipping Line, Tax Line = False
Printed picking ticket = True
Summary criteria (this is the part I don't know how to to, it would not be any problem if I could write it in T-SQL):
MAXIMUM DATE WHERE System Note.Printed Picking = TRUE < MAXIMUM DATE - System Note.Committed WHERE NEW VALUE > 0
--
The result set can then be grouped by document number.
Any ideas how I can achieve this?

Related

When one field doesn't equal another field then show a completely different field

First time asking a question and have learned a lot from this forum. I work in a weird industry and we are using NetSuite. I am having a hard time coming up with a criteria or formula for what I am trying to do. On any sales order we have the Business Source who could be the listing agent or the selling agent for a property. The business source is not always the listing agent or always the selling agent. So I am trying to do a search where (excuse the bad coding example):
If business source is the listing agent, then show the selling agent
If business source is the selling agent, then show the listing agent
From a sales perspective, we want to reach out to the other agent, even if they didn't direct the order our way, and thank them for working with us.
I hope I was somewhat clear...and thanks in advance!
Add a line in the Results tab and select Formula (text) under the Field column. In the Formula column add:
CASE WHEN {custbody_business_source} = {custbody_listing_agent} THEN {custbody_selling_agent} ELSE {custbody_listing_agent} END
You will need to replace the fields in braces {} with the correct IDs for the fields you're using. I have assumed that these fields all pull from the same list of records (contacts or customers) for the information they contain. It probably won't work, for example, if one is a select (List/Record) field and the others are Free Text. This simply compares the Business Source field with (arbitrarily) the Listing Agent and returns the Selling Agent if there's a match, otherwise it returns the Listing Agent. Note that this means the Listing Agent will be returned in any other circumstances also; for example if one of the compared fields is empty.
You could match the Business Source against both the agent fields explicitly and return some other value when neither match by extending the CASE statement a little:
CASE WHEN {custbody_business_source} = {custbody_listing_agent} THEN {custbody_selling_agent} WHEN {custbody_business_source} = {custbody_selling_agent} THEN {custbody_listing_agent} ELSE {somethingelse} END
or by using a DECODE instead:
DECODE({custbody_business_source}, {custbody_listing_agent}, {custbody_selling_agent}, {custbody_selling_agent}, {custbody_listing_agent}, {somethingelse})
DECODE has the following signature:
DECODE({expr}, search, result, [search, result]..., [default])
It compares expr with each search value one by one. If it finds a match it returns the corresponding result. If no match is found, the default is returned, or null if default is not specified.

How can I include the main line ship date in line item results for a sales order saved search?

I am trying to create a Saved Search that can be used to break down on time shipments by item type. However, I've noticed that {shipdate} isn't included in the results for the line items on sales orders.
Here is an example search where the "Inventory Item" line does not have ship date.
I've tried using a formula field and variations of {*.shipdate} and {mainline.shipdate}, but they only produce errors; {mainline.shipdate} produces "Field not found" and {*.shipdate} produces "Invalid Expression." I do not have the same problem with {actualshipdate} as this date is displayed on line item results when included.
How do I access this main line dimension on line item results?
That is odd that your NetSuite isn't returning the mainline ship date on every line. It does for me, so perhaps there is a setting somewhere.
Apart from finding a setting, the simplest way to return the Ship Date on every line is with an analytic function:
MIN/*_*/({shipdate}) OVER (PARTITION BY {internalid})
Nathan's answer made me want to take another look at this, as I was also surprised that NetSuite was not returning the Ship Date field with each line. I found that having Demand Planning enabled affects how NetSuite displays the Ship Date.
From SuiteAnswers:
If the Demand Planning Feature is enabled, values for the Date Shipped column in the Report will be sourced from the 'Expected Ship Date' column on the line item level of the Sales Order. Thus, using Ship Date on the report will return a null value if Demand Planning Feature is enabled.
So turning demand planning on means line Ship Date = null, demand planning off means line Ship Date = head Ship Date (in saved search).
Probably not really of any practical help, but good to know the underlying reason.
One approach would be to make a custom column (line) field and copy the header ship date field to each line using a workflow or script (could be scheduled or triggered on the before submit event).
Another way to work around it could be to use the new SuiteAnalytics workbook feature, if you don't have other things depending on this to be a saved search.

Using a NetSuite saved search formula to filter from system notes

I am attempting to use a NetSuite saved search to bring back system notes for whenever an assigned person changes for a case. However, I would like to grab the initial assigned person and not the multiple re-assignments after that. Is there a way for me to only select the initial value rather than having all re-assignments come back to me? Is this able to be done from a formula somehow?
to get the oldest assignee of case you can use below criteria so, that results is restricted to just one result per case
1) System Notes : Field is assigned
2) System Notes : Old Value is empty
In the results add the column System Notes : New Value along with other columns of case. This field will pull the oldest assignee of the case
PS : solution assumes that there won't be any empty re-assignments. If there are empty re-assignments you should sort the results by Case unique identifier such as number or internalid and then by System Notes : Date, and the oldest date line would be the result that you are looking for.
Actually you can do that with a search clause where the old value is empty

SharePoint Calculated Field resets on item edit

I am using a SharePoint list that was migrated from an old Windows 2003 server to an existing 2008 server. This list is used to track issues raised by users against another application - a list of jobs to do if you will.
In the old list there was an Id field. When the list was recreated in the new area the assigned ID number was different, for example
Old ID New ID
--------- ---------
5 204
6 2
7 3
8 159
9 4
This assignment does appear to be fairly random.
To negate this a calculated column was created, so IDs raised before the migration use the Old ID number, and new calls raised after the migration use a calculated value. The calculation is
=IF(ISBLANK([ID (Old)]),ID+8,IF([ID (Old)]<=348,[ID (Old)],ID+8))
This compares the ID (Old) to blank, and if so, it is a new call and should have the default ID number, plus 8 (I think there was a total of 8 calls made during development that were then removed).
Otherwise if the Old ID number is less than 348 (the call number when we migrated), use the Old ID number.
If neither condition is met, simply set the ID to the new ID number plus 8.
This works fine when creating new calls.
The problem arises when I edit a call. For example if I set the ETA to a new value and save the call, the Calculated ID is always reset to 8.
I can fix this by going in to List Settings -> Opening the calculated column -> and clicking OK. This reapplies the calculation and everything is numbered correctly again.
For information - due to the environment this is deployed in I am not able to use SharePoint Designer at all.
The question is, how can I stop the renumbering when I edit an item?
The ID field behaves a bit oddly with calculated columns. A calculated column formula will find the ID of an item and resolve it properly when items are created or when the formula is modified, but as you discovered, when an item is modified, the formula can't find the ID value. (My guess is that this has to do with the ID field not being included in the list of column values being sent to the database on update, perhaps because the ID field should never change.)
One way around this is to use a workflow (or a custom event handler, if you have too much time on your hands) to copy the ID field to another column, such as a number or single line of text column, whenever an item is created. You can then use that new column in your formula instead of using the ID column.
To prevent people from updating your dummy ID column, you can hide it from the forms. To do this, first enable management of content types for the list, then edit the Item content type, find the new dummy ID column, and change it to "Hidden" (instead of "Required" or "Optional").

Crystal Reports - my formula works, but when repeated in more than 1 subreport, all records disappear

I'm not a developer but I'm supposed to create a report by C.R., so excuse me in advance if it is an obvious question for you, and please keep in mind that I'm a real beginner.
I have a job composed of 3 different workings (3 out of 5, which is the maximum workings I can have for a job).
In my SQL database, the table.field corresponding to those workings is job.phase, so when I put, in my report details, the field "job.phase", I get 3 rows for that job.
The point is that my report printout always has to show 5 different text objects (one below the other), corresponding to the descriptions of all the 5 possible table.field-records, and a 'X' should appear next to text objects when each one of the workings listed there is a part of my job (otherwise nothing should appear).
What I have done is the following:
- created a subreport containing the "job.phase" field
- put it near my first text object
- specified in my subreport the following "show string" formula:
if job.phase = 'working1' then 'X' else ''
and it works: a X appears if working1 is part of my job, nothing appears if working1 is not part of my job.
Then I have created 4 subreports more, equal to the first one, and specified the same for job.phase = working2, working3, working4 and working5, BUT, after doing that, no X is shown (even though working 1, 2 and 3 are part of my job)...
Is there anybody who can help me, please? It's so frustrating...
Using subreports for something like this is overkill for what you're trying to do and could be causing any number of things to behave badly. I'd recommend you abandon that idea. Here's how I would do it:
The first thing you'll want to do is group by job (if more than one will appear in your report, which I'll assume it will). The Group Footer section is where you can display the labels and Xs. You'll need to create 5 formulas as you did before if {job.phase} = "working1" then "X", one for each of the phases/workings. Drop all 5 of those formulas into the Details section of the report and then suppress that entire section so that it doesn't display.
To show the Xs, you can use a Maximum summary in the Group Footer for each of the five formulas you created. To do this, right-click each of the formulas in turn, select Insert -> Summary. Choose Maximum as the summary, and "Group 1" (Your job ID or whatever field you are using to group the job) as the Location. That will insert a field into the Group Footer that will display an X when that particular working is specified for the job, otherwise it won't display anything. Move them to display next to the appropriate label/text field and you're done.

Resources