Mobile use Terrasoft.Sql.DBExecutor.executeSql for Custom Objects
Hi Community,
We are trying to execute sql in mobile using Terrasoft.Sql.DBExecutor.executeSql
But it is not working for Custom objects in only works for OOB objects. We also tried "store.loadPage" and it is only working for OOB objects. Any idea how we can use this of Custom objects in Mobile
Like
Hi Fulgen,
I've added a custom section to the RequiredModels array for the model where the rule is located and I was able to get the result. The code was:
Terrasoft.sdk.Model.addBusinessRule('Contact', { ruleType: Terrasoft.RuleTypes.Custom, triggeredByColumns: ['Age'], events: [Terrasoft.BusinessRuleEvents.ValueChanged, Terrasoft.BusinessRuleEvents.Save], executeFn: function(record, rule, column, customData, callbackConfig) { var isValid = true; var store = Ext.create('Terrasoft.store.BaseStore', { model: 'UsrCustomSection' }); var queryConfig = Ext.create('Terrasoft.QueryConfig', { columns: ['UsrIntegerTest', 'Id'], modelName: 'UsrCustomSection' }); store.loadPage(1, { queryConfig: queryConfig, callback: function(records, operation, success) { var loadedRecordTest = records[0]; if (loadedRecordTest) { var integerTest = loadedRecordTest.get('UsrIntegerTest'); if (integerTest) { record.set("Age", integerTest); } } }, scope: this }); Ext.callback(callbackConfig.success, callbackConfig.scope, [isValid]); } });
So once the age for a contact is modified it get's the value from the UsrIntegerTest column of the UsrCustomSection model and it worked correctly. Try the same approach on your end.
Best regards,
Oscar
Oscar Dylan,
Hi Oscar, did you add your custom object in your mobile manifest? It is not working using "store.loadPage" do I need to add my custom object in mobile manifest?
Fulgen Ninofranco,
Hi,
Yes, I've added it as the required model for the "Contact" model in the manifest and also added it as a section to the mobile app:
"Models": { "Contact": { "RequiredModels": ["Order", "UsrCustomSection"], "ModelExtensions": ["UsrContactAgeRule"] } },
Best regards,
Oscar