...
- Open the model Dashboards and Forms 11-13. Actions to update, insert, delete
- Find the stream Wisteria Books Return Requests, and open the view Wisteria Books Return Requests – you will see a list of book return requests
- You will add an action to update records in this view – to record when return requests are refused:
- In the configuration form for the stream Wisteria Books Return Requests, go to the Actions tab
- Press to create a new action
- Give the action the following configuration:
- Name: Refuse Return
- Display Name: Refuse
- Go to the Item Updates tab, and set
- Stream Item Action: Update
- Press Press - Apply
- The form will update – press in the Action Attributes section
- In the Stream Action Attribute Details form:
- Select the Attribute ReturnStatus
- Set Expression to: "REFUSE"
- Press Press
- In the Stream Action Attribute Details form:
- Press Press in the main action form to save your changes
- To associate the action with a view (you will use an existing view on the Stream):
- Go to the Views tab
- Open the configuration form for the view Wisteria Books Return Requests
- Go to the Menu tab
- Press - Actions
- Select your action from the drop down list and drag it into the list of actions associated with the view
- Press Press to apply your changes
- To see the new action button on the view, open the view
- Test your button: select a record and press the button
- Press on the view; you will see the ReturnStatus updated
- Test your button: select a number of records and update the ReturnStatus with your button
...
- First you need to create a form that will be used to take values from the user – in CenterView terms, this is known as a Form View:
- Open the configuration form for the stream Wisteria Books Return Requests
- Add a view:
- Name: Enter Refusal Comment
- Stream View Attributes: HandlingComments
- In the list of Stream View Attributes double-click on HandlingComments
- Set Width on Form to 300; Height On Form to 300
- Tick Multiline on Form
Press
The setting Multiline on Form determines the result of pressing the enter key when entering values into a CenterView form view. With this setting on, while the user is editing this field, the enter key will put a link break into the value being entered. While the user is in any other part of the form (except for another multiline field) pressing the enter key commits the action – the equivalent of pressing the button.
- Go to the Advanced tab
- Tick Form View
- Press Press to save your changes
- Open the configuration form for the action Refuse Return that you created during the previous exercise
- Set Form View to Enter Refusal Comment
- Go to the Item Updates tab
- Add an additional attribute:
- Press - Show the list of Attributes
- Drag in the attribute HandlingComments
- You will see that this is auto-populated with the expression _prompt.HandlingComments – leave this as it is, since this is the expression you need
- Press Press in the main action form to save your changes
...
- Create an action to insert a record
- You will need to take user input for 2 fields in the new action, so you must create a new Form View:
- In the configuration form for the Stream Wisteria Books Return Requests, go to the Views tab
- Create a grid view Add Return Request
- Add attributes to the view:
- CustomerRef
- BookTitle
- Go to the Advanced tab and tick the Form View flag
- Press
- Add attributes to the view:
- In the configuration form for the Stream Wisteria Books Return Requests, go to the Actions tab
- Press to create a new action
- Give the action the following configuration:
- Name: New Return Request
- Display Name: New Return
- Form View: Add Return Request
- Go to the Item Updates tab, and set
- Stream Item Action: Insert
- Press Press
- Press - Show the list of Attributes
- Drag in attributes:
- CustomerRef
- BookTitle
- ReturnStatus
- Set attribute expressions:
- (Accept the default expressions for CustomerRef and BookTitle, since we will take these values from the user in the form view)
- Update the expression for ReturnStatus to: "New"
- Press
- To associate the new action with the view:
- Open the configuration form for the view Wisteria Books Return Requests
- Go to the Menu tab
- Press - Actions
- Select the new action from the drop down list and drag it into the list of actions associated with the view
- Press to apply your changes
- Open the configuration form for the view Wisteria Books Return Requests
- To see the new action button on the view, open the view (if you already have it open, close it first)
- Test your button: press the new button, complete the details in the Form View and press
- Press on the view
- You will see a new row added
...
- Create an action to delete a record
- In the configuration form for the Stream Wisteria Books Return Requests, go to the Action tab
- Press to create a new action
- Give the action the following configuration:
- Name: Delete Return Request
- Display Name: Delete Return
- Go to the Item Updates tab, and set
- Stream Item Action: Delete
- Press
- To associate the new action with the view:
- Open the configuration form for the view Wisteria Books Return Requests
- Go to the Menu tab
- Press - Actions
- Select the new action from the drop down list and drag it into the list of actions associated with the view
- Press to apply your changes
- Open the configuration form for the view Wisteria Books Return Requests
- To see the new action button on the view, open the view
- Test your button: select a record, press the new button, and press
- Press on the view
- You will see the row disappear