Mobile Application Attachment as mandatory in Case on saving record when status is closed
Hi Community,
Any Idea how can I achieve below scenario in Mobile Application.
If case status is "closed", when saving record i need to show pop up message if there is no attachment.
Like
Dear Fulgen,
You can achieve such task using push notifications for mobile application. Such push notifications are created via business process and corresponding “Send push notifications” element.
By status change signal on the Case object you read the quantity on attachments on the record, which triggered process and based on the result you show push notification.
Check the following article on step-by-step implementation:
Regards,
Anastasia
Anastasia Botezat,
Hi Anastasia, Thanks for your reply
Currently in mobile, we enable the status field in case form. So user can select the status to closed. Now when saving case record on mobile and if status is 'Closed', I need to do some validation if there is attachment in 'CaseFile'. This logic is achievable in web using esq to check if there are records in 'CaseFile' and use 'asyncValidate' method for validation. Now in mobile how can i implement the same logic?
Fulgen Ninofranco,
Please check the following example. There is a query to Contact section, where we select Name, Id, Account. This is the corresponding to ESQ mobile version.
var store = Ext.create('Terrasoft.store.BaseStore', { model: 'Contact' }); var queryConfig = Ext.create('Terrasoft.QueryConfig', { columns: ['Name', 'Id', 'Account'], modelName: 'Contact' }); store.loadPage(1, { queryConfig: queryConfig, filters: Ext.create('Terrasoft.Filter', { property: 'Name', value: 'test' }), callback: function(records, operation, success) { var loadedRecord = records[0]; if (loadedRecord) { var contact = loadedRecord.get('Account'); if (contact) { ... } } }, scope: this });
Regards,
Anastasia
Anastasia Botezat,
Hi Anastasia, Thanks for your reply
From which OOB Schema this source code is added?
Fulgen Ninofranco,
Also, here is an example of how to write direct query to database:
// sql requry to DB var sqlText = "select pf.Id as ProductFolderId from ProductFolder pf " + "where pf.FolderTypeId = '9dc5f6e6-2a61-4de8-a059-de30f4e74f24' and " + "exists(select pif.Id from ProductInFolder pif where pif.FolderId = pf.Id and exists(" + "select p.Id from Product p where p.Id = pif.ProductId and " + " p.Active = 1 and p.TypeId = 'f1795fc3-36cc-4771-9222-178b339eb9f2'))"; // variable to which results will be stored var records = []; // executing query to DB Terrasoft.Sql.DBExecutor.executeSql({ sqls: [sqlText], success: function(data) { if (data.length > 0) { var columnMap = { 'ProductFolderId': 'Id' }; var queryConfig = Ext.create('Terrasoft.QueryConfig', { modelName: 'ProductFolder', columns: ['Id'] }); var ids = data[0].rows; for (var i = 0, ln = ids.length; i < ln; i++) { var sqlData = ids.item(i); var record = Terrasoft.SqlDataToRecordConverter.convert(sqlData, queryConfig, columnMap); records.push(record); } } } });
You can check MobileCaseGridPageController, MobileActivityActionsUtilities schemas.
Regards,
Anastasia
Anastasia Botezat,
Hi Anastasia, Thanks for your reply
For 'asyncvalidate' method in web. What is its counterpart in mobile? I want to execute this esq on click of save button. So I need the same functionality as asyncvalidate in web.
Fulgen Ninofranco,
Unfortunately, there is no exactly same functionality for mobile application. However, you can use business rules instead. I have prepared an example of RegExp validation, hope it suits your task:
Terrasoft.sdk.Model.addBusinessRule('Contact', { ruleType: Terrasoft.RuleTypes.RegExp, regExp : /^([0-9\(\)\/\+ \-]*)$/ triggeredByColumns: ['HomeNumber', 'BusinessNumber'] });
Regards,
Anastasia