xCP Designer makes application creation much easier than before, but there is a learning curve. It is a powerful tool that can be used to create an object model, events, business processes, queries and the user interface. This can be a lot at first and since so much has changed from the previous version, the question arises of What goes Where? And more importantly: How do you combine all these elements into a usable application?
One thing I learned while doing a xCP project is that when information needs to go from one component to another, the Designer only allows you to specify inputs. You always need to go to the Destination component and specify where it gets its input from. It is an information pull model. Once you get your head around this, it becomes easier to connect the dots.
For instance, if you want to create a page to update account details for a customer, you may want to perform some validation on the inputs before allowing the user to press the Save button. Let's say we want to check that a valid bank account nr was entered. In xCP Designer this can be configured using a Stateless Process. The process would take a customer ID as input, perform some activities that check the account nr in the bank's CRM system and produce a validation message as output.
The process could be as simple as this:
A few quick tips:
- xCP Pages can only set and read the variables of a process. Packages cannot be used.
- Don't forget to set the 'Stateless Service settings' of your input variable to 'Use for input only' and for your output variable to 'Use for output only'.
First of all we need to add the Stateless Process as a Data Service Instance to the Page.
- Open the Data Service Instances panel, click on the green + sign and add the process to the page
- Select 'Refresh when input value changes' on the General tab of the process
- On the Input tab, specify the widget that we wish to validate the value of, in this case the Account nr field.
- Notice there is no Output tab, even though the process produces an output message
So where does the output message go?
- Add a Value Display field to the form that will show the output message
- For the value of the field you can select the output message of the Stateless Process
As an extra you can also configure that the Save button is only enabled when the validation message is empty. You can do that on the Behaviour tab of the Save button.
As you can see, when you want to connect the dots in xCP Designer you always specify on the Destination object where it gets its inputs.
I hope this post was useful to you. You can leave a comment if you have anything to add.