Call automation commands in scripts & Entity Account Helper

Well Ive gone through and and coding in most of the day to day management into a website. I’m up to creating entities with accounts from the website, but I’m a bit stuck because of the extensive different SQL queries that go through. I.e. when I need to create an entity for an account
I have to insert a new account into the account table making sure the id is 1 up, then I have to do the same with the entities table, making sure the account is correlated and hat the id is unique. Im pretty sure i could easily break something major doing all these queries so I would like to move back to using Samba.

My first guess would be using an API to add the entity, but theres nothing to create an account with it. So I guess I could use some rules and actions to do this… But I can’t call these from scripts. Im just a bit concerned what to do, all I want to do is replicate this button press and what it does:

Entity Type

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

Entity

api.Entity(name).State(name).Update(state);
api.Entity(name).State(name).Get();
api.Entity(name).Data(name).Update(value);
api.Entity(name).Data(name).Get();
api.Entity(name).Exists();
api.Entity(name).Create(entityTypeName);

Account Creation

api.AccountType(name).Create([rule|'All','Credit','Debit']);
api.AccountType(name).Exists();

api.Account(name).Exists();
api.Account(name).Create(accountTypeName);

api.Entity(name).CreateAccount([accountName]);
1 Like