Question

Mobile Application - Execute Esq in "Terrasoft.BusinessRuleEvents.Save" event

Hi Community,

 

We have this scenario below

 

In mobile during "Terrasoft.BusinessRuleEvents.Save" event we need to do some complex validation. We need to execute esq to check whether the record is linked to sub tables or not, if it is linked then Saving will not be allowed.

 

Any idea how we can achieve this? In web this is possible however I couldn't find  any example doing esq on "Terrasoft.BusinessRuleEvents.Save" in mobile.

 

Like 0

Like

2 comments

Hi Fulgen,

 

There is no example of using ESQ inside the business rule that is triggered upon a record save. But you can try creating a server-side logic that will be triggered upon the record save (either a process in the object or using the EventListener) that will then send a push notification and stop record saving in case some conditions are not met. To send a push notification you can use the following construction:

var userConnection = this.Get<UserConnection>("UserConnection");
var pushNotification = new PushNotification(userConnection);
var sysAdminUnitId= new Guid("85AEEF58-0827-41E0-BFC8-1C1DC7D97B6C");
var title = "Validation error";
var message = "Message text";
pushNotification.Send(sysAdminUnitId, title, message);
return true;

also

 

Terrasoft.Configuration

Terrasoft.Core

Terrasoft.Core.Factories

 

assemblies should be added to the code (or the process using). The sysAdminUnitId parameter is an Id of a user that should receive this message, can be dynamically received using the

(Guid)UserConnection.SystemValueManager.GetValue(UserConnection, "CurrentUserContact");

construction and SelectQuery class request to the database to get the SysAdminUnit Id value by ContactId.

 

Best regards,

Oscar

Oscar Dylan,

 

Hi,

 

How about using "store.loadPage". I think it is possible to use this, however it is not working for custom objects, it is only working for OOB objatcts like Contacts and Accounts. Any idea about  "store.loadPage"?

Show all comments