I have setup my Customer entity type with “NIT” (Tax Income Number) as the primary field and “Nombre” (Name in Spanish) as a custom field.
I have created two custom “Update Ticket Tag” actions to collect the NIT and the Nombre of the customer before printing an invoice. When I use a rule with these two actions I get this dialog:
If the ticket already has a customer associated, then those text boxes will be populated with the corresponding values since the actions have “ENTITY NAME:Customer” and “ENTITY DATA:Customer:Nombre” as default values.
What I need is the ability to search for a customer when the user has entered the NIT. If the client is found then the Nombre text box should be populated with it.
It would also be great to be able to store a new client when the two values were entered and no customer was found.
Does anyone know how to implement this work flow?
That is how the entity search widget works by default. Have you tried an entity screen with that widget? Or even a default search screen?
No I have not tried that. Is it possible to invoke such screens on demand from within a rule?
Is there a way to call an entity screen as a dialog?
If you share your entire flow you are planning it might help us recommend better options.
To answer your question, yes you can automate changing screens with the Navigation action.
In the payment window I have a “Imprimir Factura” (Print Invoice) button. To print the invoice I need the customer’s NIT (Tax Income Number) and Nombre (Name).
Two possible scenarios:
- When the Ticket already has a customer associated then the customer NIT and Nombre should be displayed in the dialog.
- When the Ticket does not have a customer associated then those values should remain blank.
In any case, if the user types a NIT (or overwrites the current one) the dialog should display the corresponding Nombre for such NIT. If there is no customer for such NIT then the NIT and Nombre values should be used to create a new customer entity when the user clicks OK.
As you said maybe the “Search Customer” screen can be reused for that task. In that pursuit I have created a Change Ticket Entity action:
Action type: Change Ticket Entity
Can Create Ticket: False
Entity Type Name: Customers
Entity Search Value:
Update Null Entity: True
Entity Screen Name: Search Customer
Entity Screen Search Value:
This opens the Search Customer screen while in the Payment window but once I click the Select Customer the Ticket window is displayed instead.
As you suggested @Jesse I am trying to use the Search Customer screen to select/display the customer from the Payment window.
The problem is that once I select the customer I end up in the Ticket window. I would like it to remain in the Payment window.
Do you know how can I prevent the Search Window from switching to the Ticket window?