Applies To
Product: Netsuite 2019.2
Scenario
Create a workflow that will set a standard or custom date field to a weekday or the following Monday if the value inputted falls on a weekend.
Solution
- Navigate to Customization > Workflow > Workflows > New
- On the Workflow Creation Page, set up the following values:
- Name: WF Set Date Field
- Record Type: Transaction
- Sub Types: Sales Order
- Execute As Admin: is checked
- Release Status: Released
- Initiation: Event Based
- On Create: is checked
- On View or Update: is checked
- Trigger Type: -All-
- Event Types: Create
- Context: User Interface
- Click on Save
- On the diagrammer, click on State 1
- On the context panel, click on New Action
- From the list of actions, select Set Field Value
- Configure the workflow action with the following settings:
- Under the Basic Information Section configure the following:
- Trigger On: Before Record Submit
- Under the Parameters section, set the Field to: Date
- Under the Value section, select Formula radio button
- Paste the formula below on the formula box:
- case when INSTR(to_char({trandate}, 'DAY'),'SATURDAY') != 0 then {trandate}+2 when INSTR(to_char({trandate}, 'DAY'),'SUNDAY') != 0 then {trandate}+1 else {trandate} end
- Under the Basic Information Section configure the following:
- Click Save
- Click Done Editing