Article

Mobile app. Synchronization error: Organization field is required (Terrasoft.ODataRequiredColumnsEmptyValuesException) (UiV2 / Offline)

Question

Required "Organization"  field is affixed to the contact object "at the application level"

In the mobile app:



- Create a new contact

- Fill in the "Organization" field (created earlier in the web app)

- Save

- Synchronize

- An error occurs

Call Stack:

Contact (9d6652ba-5062-45d2-a7f2-1fb6c3ba1978) at Wed May 16 2018 11:13:07 GMT + 0300 (MSK). Error text: Type: Terrasoft.ODataRequiredColumnsEmptyValuesException

Message: The Organization field is a required field.

AdditionalInfo: {"position": 0, "error": {"code": "3", "message": {"value": "The Organization field is required"}, "innererror": {"message": "Organization field is required", "type": "Terrasoft.Core.Entities.RequiredColumnsEmptyValuesException", "stacktrace": "in Terrasoft.Core.Entities.Entity.ValidateRequiredColumns () \ r \ n in Terrasoft.Core.Entities .Entity.InternalSave (Boolean validateRequired, Boolean setColumnDefValue) \ r \ n in Terrasoft.Core.Entities.Entity.Save (Boolean validateRequired, Boolean setColumnDefValue) \ r \ n in Terrasoft.Core.Entti.SerathiraADe.V. \ r \ n in Terrasoft.Core.Entities.Services.ServiceContext.SaveChanges () "," internalexception ": null}}}

Everything works correctly if the field is not required.

Answer

Contact and Account objects are bound by cyclic links (for example, in a mobile application, both a contact and an account (as well as the connection between them) can be added).

Therefore, when synchronizing records, requests are split for correct storage: 

First, creating a contact record, then creating an account, then the lookup fields of the connections between them are updated with the necessary values of the newly created data. Thus, the binding will not work.

As a workaround, we can propose making it required at the card level using business rules:

Terrasoft.sdk.Model.addBusinessRule('Contact', {
    ruleType: Terrasoft.RuleTypes.Requirement,
    triggeredByColumns: ['Name']
});

Then add the required module to the manifest in the ModelExtensions section.

An example implementation can be found in the "MobileActivityModelConfig" schema.

Like 0

Like

Share

0 comments
Show all comments