I am trying to set a condition in a NetSuite workflow so it only triggers when the date of emp. Termination = today and the date that same field was edited also = today. This is what I have but it is not working:
(DECODE({systemnotes.field.id}, 'custentity_emp_termination_date',{systemnotes.date})={today}) and {custentity_emp_termination_date} = {today}
Thanks in advance!
{systemnotes.field.id} is not a real field. It implies a multi-level join (from current record to System note to Field), which NetSuite does not allow outside of SuiteAnalytics. The "Name of Field" can be viewed if you put "{systemnotes.field}" in a saved search to see how it is formatted since it'll have to be exact.
Replace the code with:
DECODE({systemnotes.field}, 'NAME OF THE FIELD',{systemnotes.date})
Related
We are building out the ARM module of Netsuite and our director of Accounting would like the Contract Start date on the header level to be populated with the earliest Term Start date from the line items on the sales order.
I'm just starting this project and am new to Suite Script. I'm hoping to get pointed in the right direction and work f rom there.
To filter earliest date from lines, you first need to fetch all the dates which can be done using record.getSublistValue which requires a set of parameters which you can find here. Once you have filtered out the date, you can set it on body field using record.setValue and you can find its documentation here.
To get the record, it depends on which script-type you are working on, like if you are sripting in User-Event, you will receive newRecord in its script parameter. Whereas if you are working on some scheduled/map-reduce script, you might have to load the record using record.load from N/record module.
You can also do this in the UI without SuiteScript.
Create a saved search with results as Term Start Date with a summary of Minimum.
Add any criteria that you may need (such as Term Start Date is not empty)
Add a filter of Internal Id.
Create the custom field, and under Validation and Defaulting select the previously created saved search. Make sure that stored value is checked off for the custom field!
Look into the article "Creating Custom Fields with Values Derived from Summary Search Results" in the help center for more information!
I found the way to filter a view by creation date ;
In the Search I put for example :
return "[_CreationDate] >" + fromDate +"'";
Is their a similar way to only get the documents from a certain modification date in my view?
The page in Domino Help entitled "How can I refine a search query using operators?" is very useful.
[_RevisionDate] is the internal field you want.
If using replicas, please note this gives the date the document was modified, not the date it was modified in this file (i.e. the date the updated document hit this replica).
I'm new to Orchard CMS and trying to create a query that will filter a list of upcoming events date. What I want to do is filter a list of upcoming events. I have set up a list and plan to use the creation date (setting the date to the event date) as filter. Where I have ran into an issue is getting the filter value to work. When I set the filter value to {DateTimeField.Date} for get the current date or any of the other date options, the filter does not work. It show all events. When I manually type in the value field "2014-08-20", it works. Any ideas of why I can not set the date to the current date?
I have also tried creating just a date field within the content definition and received the same issue as above. I do plan to create a Event End Date that will not show, but will be used to filter. I assume the value will be very similar though to what would be needed for the creation date though.
I am using Orchard CMS 1.8.0
Any help will be greatly appreciated.
The current date can be obtained in Token form like this: {Date}. That token itself can be modified as a date token. In particular, it can be formatted. In your case, because the filter will construct a HQL filtering clause from your expression, {Date.Format:yyyy-MM-dd} will put the current date into the right format.
For our Employee records within NetSuite, we have a custom field called "Employee Number" with an ID of custentity1. I've created a workflow that will automatically create a new employee record and populate various fields but the one I'm having difficulty with is the Employee Number field. All I want to do is to grab the largest employee number there is out of all of the Employee records and add one to it for the new employee record.
The Employee Number field is a free-form text field so I know I'll have to use TO_NUMBER, but anytime I try and reference {custentity1} I keep getting an error saying that field is not found.
UPDATE: I've created a new custom field for our employee records called "Employee No." with an ID of custentity_employeenumber. I've also created a javascript file with the following:
function getMaxEmployeeNumber(){
var empNumber = nlobjSearchColumn('custentity_employeenumber', null, 'max');
return empNumber;
}
But how to do I get this to work with my records?
NetSuite does have an auto-numbering mechanism built in to its native functionality that most of our customers use for this exact purpose. Is there a special reason this functionality is not being leveraged? This functionality is accessible at Setup > Company > Auto-generated Numbers.
I do not work much with workflows, so I do not know if this same functionality is possible there, but here is how I would solve this in SuiteScript:
Create User Event script that is executed on Before Submit Create event for Customer records
Create a Customer search that has a Search Column for custentity1 with a summary type of max
new nlobjSearchColumn('custentity1', null, 'max');
Running this search should give you 1 result, which is the maximum customer number. You can then just add 1 to it.
You could create a similar Saved Search in the UI to see what the result set looks like.
This will only really work if the field is a Number, not Text. I would suggest changing the field to an Integer field if you know that it will always be a number. This may clear out existing data, so first you could export all customers and their number to Excel and then do a CSV import after changing the field.
How are you looking for the last employee in a workflow?
I know this can be done in js:
Search employees - returns max 1000
For number of employees give me the custentity1 of the last one - nlapiLookupfield('employee',employees[employees.length],'custentity1')
Add +1 and save on new record
If you use this search column
nlobjSearchColumn('custentity1', null, 'max');
You can also sort it in decreasing value so that the first result is always the max. Something like
nlobjSearchColumn('custentity1', null, 'max').setSort(true);
I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system.
I dont want to give the user to select a Date Time instead it should populated automatically
Is there anyway to achieve this without writing code in code behind files?
This is very similar to this question I think
SO - How to get Date and current time from the Date/Time column in SharePoint Custom list
My answer there gives a few options such as using the built in Created field, using a calendar template, a JavaScript hack and a custom field type.
Guys, fake [Today] trick worked for us - but prob is we only got the date value not datetime.
Janis, is it possible to get date and time both from the fake [today] column trick? pls refer few articles on the same
Does [Today] work?
If you have language pack applied to SharePoint, then you must use localized "Today" string.