Multiple Entity Ticket Assignment Error

HI @emre (and anybody else who can help!)

I have Entity Types that get assigned to a Ticket when a Master Entity Type:Customer is selected - NICE! The issue is for some reason the 3rd Entity Type I am trying to assign will not let me create an account?

Note: I used “Cloning” to create most of the 2nd Entity Type -> 3rd Entity Type.**

Sample Ticket:
Emre you will notice the Account Format is not being obeyed for the 3rd Entity Type “Prize Wallet”?

I have hooked up some standard screens to Create an Account for the 3rd Type - Prize Wallets. I have done this just to ensure I use the “normal process”. This fails…

Create Account Fails


2nd Entity Type Setup - Bar Account (Works Great)



3rd Entity Type Setup - Prize Account Failing (Cloned from above)



Can somebody please help?
I gut feeling is the Keys for {ENTITY NAME} being the same is getting lost in the code? “Member No” is used for all 3 Entities - Customer, Bar Wallets & Prize Wallets.
Have also tried manually assigning just 3rd Entity to Ticket but this also fails with the Account Creation?

Have you created the Prize account type?

Hi JLT - yes have run through many times.

Do the first two both have Member No. as the primary field name?

Yes they do, however, the format I am using is:
01000 - for Customer
01000B - for Bar Accounts
01000P - for Prize Accounts

All are “Member No” as Primary Field Name. SEE ABOVE, all formats displayed.

The create account is enabled? is the account being created or not?

No - the Account which exists I manually created. So even though it exists SambaPOS ignores it?
Umm, maybe I should try another Master Entity: Customer and create both Accounts using the Search Screens?
Just trying that now…

Ah Crap!
You see it always good to walk through and talk about it!
It seems to work for other Customers but not my first Entity Type: Prize Account? There must be an error in the database. I will just delete the Accounts and shut my eyes so to speak.

Thanks for listening @JTRTech!

Sorry, so what was the issue?

Just a SambaPOS internal “thingy” I guess? I have not changed anything just tried another Customer and Created both 2nd & 3rd Entity Type using the Search Screens.

In practise these Entity Types will be created automatically through an SQL-API.

Here is the Result:

1 Rule brings all Related Entities onto the Ticket (and off). No other work required :smile:

You can use the JSCRIPT api for this no need to use SQL

api.EntityType(name).Create(entityName,[defaultStates])
api.EntityType(name).Entities().State(name).Update(value);
api.EntityType(name).Exists();
api.EntityType(name).Fields(name).Exists();
api.EntityType(name).Fields(name).FindEntityName(searchValue);
api.EntityType(name).Fields(name).Create(fieldtype,[format],[valuesource],[hidden]);

As you can see it also allows you to check if an Entity Type exists. I use this in the Time Clock and Punch Editor configuration task for validation when adding Employees

Sorry @Jesse - I was sort of referring to my “wish list” as all the data will come from a foreign database using ODBC. Foreign database will be the Master and request to send new records and other CRUD transactions (including new tickets) to SambaPOS.

Hmm I must have missed a conversation where you mentioned that. To save me from trying to search for it can you explain what your plan is? I dont recall a conversation where you shared that idea? It sounds interesting you have my attention.

PS. I have not shared much information about it but I have integrated two way communication with TimeTrex. It required some extensive coding server side and SambaPOS side to get it working but TimeTrex communicates to SambaPOS and SambaPOS communicates back to TimeTrex I can receive and send information from both sides.

I plan to share my work soon it might inspire other integration ideas.

Here is the Link:
http://forum.sambapos.com/t/santas-shopping-list-sql-api-into-sambapos/8685?u=pauln

As it s still 2015 (barely) I thought I would leave it a few days and change the Topic and see if I could get @emre on board.

Rules, Actions etc in SambaPOS? - what did you use on the Server?

Well TimeTrex has a very nice web API interface with options to use SOAP or JSON methods. I know thats specific and not every solution will have that sort of API but I think it could inspire some things once I get time to really share it.

I had to design some very specific scripts that run serverside which allow various commands that PUT or GET information from the database. I can send those commands from SambaPOS using scripting.

TimeTrex atm communicates to SambaPOS by creating gists to my Github account and SambaPOS can execute the tasks using the action. Right now its just in testing… but seems to work quite well.

This leaves me with one question and its for @emre would it be a good idea to allow automation for updating configuration tasks? So I should be clear everything works atm except one small kink and its the fact that SambaPOS needs to update the Tasks periodically so it fetches the new data from Github. So technically right now that is the only hiccup for it being fully automated communication between the two.

Ah knew it! - Well was not sure but this arvo I looked through all the “Events” in SambaPOS to see what I could use to trigger an API call. I thought at the time maybe a Conf Task is the only option as there no real “real time” event to hook into?

I am angling at the ODBC path as it will eliminate lots of setup.

Technically all we would need for this to be possible is a way to auto refresh configuration tasks. Github allows application access to Write to gists. I have already tested this and it works great.

Yes interesting thought…

My concern is how real time will it look? I have built a dozen different integrations before but all “low level” - batch as most systems were legacy and did not support API’s.

My desire is to really integrate POS with 3rd party systems (obviously my membership database). The Membership will generate Customers [ENTITY:Customer] and Invoices [TICKET]. This data will be propagated into SambaPOS and thus receipts and acknowledgements need to be returned.

Yes obviously a more robust method to connect to SambaPOS would be better. I am exploring ideas that could work now.

Real Time would be dependent on how often it updates the tasks… This could be an issue for what you want. For my needs it only would be for occasional updates for things like schedules, payroll etc.

Googling Time Trex ODBC - and it seems there are possibilities there as well…
My goal is to expand the current SambaPOS API to include Transactions and currently find a neat method to create the communication. A trigger to SQL-API wrapper was my original thoughts.

If this can be done, trust me, just about every aspect of the API will be tested and laid out systematically :smile:
Well really I have no option, its either this way or write data directly which can be done now, BUT, is risky if you do not have an intimate knowledge of the structures.