Question

Aurena (UPD10) how to re write expression in dialog box to make field required

  • 5 November 2021
  • 1 reply
  • 172 views

Userlevel 3
Badge +6

Hi,

I’ve made a Field in Aurena in ‘’My Time Registration'’ Required. However, it is possible to save without enrich it with any values. So basically it’s NOT required/mandatory even though it ticked. See below image. The required field is in a Dialog Box.

I contacted IFS Support with following answer: 

As I explained earlier, changing the expression that should in theory work, but it is very hard to get that expression correct, and we don't support editing such expressions so that has to been done on your own risk. Unfortunately, we don’t have documentation on how to re write the expression and it falls outside the scope of maintenance and support.
 

Two expressions can be changed. In the ‘Editable’ field for the field ‘Resource’: 

And for the Dialog Box itself: 

Expression from the Resource field:
{"==":[{"var":"record.EditResourceId"},"TRUE"]}

Expression from Dialog Box 'Save and Report Again' and 'Save'
{"or":[{"and":[{"or":[{"==":[{"var":"record.AttInterval"},true]},{"==":[{"var":"record.AttInOutOrg"},true]}]},{"and":[{"and":[{"!=":[{"var":"record.InTime"},null]},{"!=":[{"var":"record.InPersClass"},null]}]},{"or":[{"and":[{"==":[{"var":"record.OutTime"},null]},{"==":[{"var":"record.OutPersClass"},null]}]},{"and":[{"!=":[{"var":"record.OutTime"},null]},{"!=":[{"var":"record.OutPersClass"},null]}]}]}]}]},{"and":[{"==":[{"var":"record.AttAbsence"},true]},{"!=":[{"var":"record.AbsenceInTime"},null]},{"!=":[{"var":"record.AbsenceWageCode"},null]}]},{"and":[{"==":[{"var":"record.AttLunchBreak"},true]},{"!=":[{"var":"record.LunchInTime"},null]},{"!=":[{"var":"record.LunchOutTime"},null]},{"!=":[{"var":"record.LunchBreakType"},null]}]},{"and":[{"==":[{"var":"record.AttGrossInterval"},true]},{"and":[{"and":[{"!=":[{"var":"record.InTime"},null]},{"!=":[{"var":"record.InPersClass"},null]}]},{"or":[{"and":[{"==":[{"var":"record.OutTime"},null]},{"==":[{"var":"record.OutPersClass"},null]}]},{"and":[{"!=":[{"var":"record.OutTime"},null]},{"!=":[{"var":"record.OutPersClass"},null]}]}]}]},{"or":[{"and":[{"==":[{"var":"record.WageGrp"},null]},{"==":[{"var":"record.WageCode"},null]}]},{"and":[{"!=":[{"var":"record.WageGrp"},null]},{"!=":[{"var":"record.WageCode"},null]}]}]}]},{"and":[{"==":[{"var":"record.AttResult"},true]},{"!=":[{"var":"record.WageGrp"},null]},{"!=":[{"var":"record.WageCode"},null]},{"!=":[{"var":"record.WageHours"},null]}]},{"and":[{"==":[{"var":"record.AttManresult"},true]},{"!=":[{"var":"record.ManRsltWageCode"},null]},{"!=":[{"var":"record.WageHours"},null]}]},{"and":[{"==":[{"var":"record.AttPrjrep"},true]},{"!=":[{"var":"record.ShortName"},null]},{"!=":[{"var":"record.ReportCostCode"},null]},{"!=":[{"var":"record.DayHours"},null]}]},{"and":[{"==":[{"var":"record.AttWo"},true]},{"!=":[{"var":"record.WorkTask"},null]},{"!=":[{"var":"record.WorkOrder"},null]},{"!=":[{"var":"record.DayHours"},null]}]},{"and":[{"==":[{"var":"record.AttShpord"},true]},{"!=":[{"var":"record.Operation"},null]},{"!=":[{"var":"record.TimeType"},null]},{"!=":[{"var":"record.DayHours"},null]}]},{"and":[{"==":[{"var":"record.AttIndirect"},true]},{"!=":[{"var":"record.Contract"},null]},{"!=":[{"var":"record.IndirectJob"},null]},{"!=":[{"var":"record.DayHours"},null]}]},{"and":[{"==":[{"var":"record.AttShopClock"},true]},{"!=":[{"var":"record.Operation"},null]},{"!=":[{"var":"record.TimeType"},null]},{"!=":[{"var":"record.InTime"},null]}]},{"and":[{"==":[{"var":"record.AttIndirectClock"},true]},{"!=":[{"var":"record.Contract"},null]},{"!=":[{"var":"record.IndirectJob"},null]},{"!=":[{"var":"record.InTime"},null]}]}]}

 

Anyone who succeed with changing such an expression in Aurena or know another approach to make the field required?

Thanks!!

Br


1 reply

Userlevel 5
Badge +6

Hi @Christian Cordius 

 

First identify the name of the new field you added in the page (e.g : ResourceId)
Then go to the command group of dialog page and navigate to the command (Save or Save and Report again) where you want to enable/disable based on the availability of the value in newly added field.
In there you can see the Enabled field and in there all the condition sets to enable this command button is implemented. 
Copy that condition set and save it somewhere.
Now fill the Enabled field with following condition which only check whether this newly filed has a value or not to enable this command button. 

{"and":[{"!=":[{"var":"record.<name of the newly added field>"},null]}]}   <-------------- this means newly added field should not be null (should have a value)

e.g :

{"and":[{"!=":[{"var":"record.ResourceId"},null]}]}

This should work as expected and now you can see that the command button is enabled only where there is a value in newly added field (all other default mandatory fields will be not mandatory, since we isolate the filed resource id here)

Now we need to put this command in the proper location in original condition set which enable this command button.
So carefully go through the original condition set and you can use notepad++ to identify start and matching end braces to separate conditions and and there we need to separate all condition sets based on 'or' and 'and' operators and put this newly created condition ({"and":[{"!=":[{"var":"record.ResourceId"},null]}]}) everywhere when it is needed. 

If we add this new condition in every places where it needs, this should properly work and as expected. 

 

Thank You and Best Regards,

Dammika

Reply