Explore the available features to take full advantage of the new help platform!

How to configure business rules?

Prev Next
   
  • PT

  • ES


Extensibility is an important advantage for any product. In Valuekeep, you can define which fields must be filled in and create rules to ensure that these fields are filled in correctly.


Business Rules Configurator

The business rules configurator is available as an add-on (additional cost) and only on the Universe line.

The entities that allow this extensibility are:

  • Equipment (including tools);
  • Locations;
  • Work orders;
  • Requests;
  • Routes;

After purchasing the add-on, you can access the feature via the menu by going to Settings | System | Business Rules Configurator.

Fields displayed

The fields are listed in alphabetical order, with custom fields appearing at the end.

The definition of a custom field as mandatory continues to be done through the Creation of custom fields menu option.

The Only on creation field affects the calculation of the Calculation Formula field. If this field is active, the calculation formula will only be applied when the record is created.

The Calculation Formula field will only be calculated when the record is saved, which means that if there is a calculation formula associated with a field that is already mandatory by default, you will have to fill it in manually, and when you save, the value calculated by the formula will replace the value you entered.

Fields that are mandatory by default do not allow the mandatory requirement to be removed.

The following types of custom fields cannot be configured in the business rules configuration:

  • Email;
  • Phone;
  • EntityLookup, of type ValueList;
  • Enumerable;
  • Url;

Business Rules

Some rules that can be applied are as follows:

Equipment/Locations

Some rules applicable to equipment and locations are as follows:

RuleField where to apply the formulaValidation fieldFormula example
If the brand is filled in, the model must also be filled in.ModelRequired formulaHasValue([BrandNaturalKey])
The warranty end date is 15 days after the date of entry into service.End dateCalculation formulaDateAdd('d', 15, [OnServiceDate])
The equipment description is the concatenation of the first three fields of the location, followed by the text ‘MC CUSTOM’.DescriptionCalculation formula'Concat'(Substring([LocationNaturalKey], 0, 3),'MC CUSTOM')
The remarks contain 10 characters from the description.RemarksCalculation formulaSubstring([Description], 0, 10)

Requests and Work Orders

The following fields are available for customization:

Requests

  • Description;
  • Type of request;
  • Asset type;
  • Priority level;
  • Reason for the request;
  • Operating status;
  • Remarks.

Work orders

  • Actual cost;
  • Actual duration;
  • Type (asset type);
  • Customers;
  • Description;
  • Expected cost;
  • Expected duration;
  • Operating status;
  • Remarks;
  • Responsible;
  • Work order type;
  • Workshop;

Some rules applicable to requests and workorders are as follows:

RuleField where to apply the formulaValidation fieldFormula exampleRemarks
Apenas deve ser possível criar ordens de trabalho para o tipo de ativo equipamento.Asset typeValidation formula[AssetTypeValue] == 2
Se o tipo de ordem de trabalho for “CR”. o tipo de ativo tem de ser equipamento.Work order typeValidation formula-          Ifs([WorkOrderTypeNaturalKey] == 'JQ' && [AssetType] != [AssetTypeValue.Equipment], false, true)

-          !([WorkOrderTypeNaturalKey] == 'JQ' && [AssetType] != [AssetTypeValue.Equipment])

Quando a ordem de trabalho transita para o estado Aprovado, o campo de utilizador Orçamento tem de estar preenchido.User_ QuoteRequired formula[SchemaEntityStateNaturalKey] == 'OT02'The user field created is of the short text type and is not mandatory.
Quando a ordem de trabalho transita para o estado Executado, o campo Custo Esperado tem de ser diferente de zero.Expected CostValidation formulaIfs([SchemaEntityStateNaturalKey] == 'OT03' && [ExpectedCost] == 0, false, true)
Quando uma ordem de trabalho transita para o estado Fechado, o campo Tipo de Reparação tem de estar preenchido.User_ RepairTypeRequired formula[SchemaEntityStateNaturalKey] == 'OT04'
Quando uma ordem de trabalho alterar para o estado Em Curso, o campo Fornecedor não pode estar vazio.SupplierRequired formula[SchemaEntityStateNaturalKey] == 'OT02'
Se a ordem de trabalho passa para o estado Fechado, o campo de utilizador Site tem de ser preenchido.User_SiteRequired formula[SchemaEntityStateNaturalKey] == 'OT04'The Site field is a custom entity. If the Date field is filled in, the Duration field must be greater than zero.
Validar que se o campo Custo esperado estiver preenchido, a duração esperada não pode ser zero.Expected DurationValidation formulaIfs(HasValue(ExpectedCost) && [ExpectedDurationSeconds] == 0, false, true)The Expected Cost field and the Expected Duration field are always zero by default. Applying this formula defines that these fields can never have a value of zero.
Validar que o campo Duração real é sempre maior do que zero.Current DurationValidation formulaIfs([ActualDurationSeconds] > 0, true, false)
Preenchimento das observações com base na informação de outros campos.RemarksCalculation formula'Concat'([Date],'-',[Description],'-', [WorkOrderTypeDescription],'-', [CustomerDescription],'-',[SupplierNaturalKey])

Examples of calculation formulas

Some of the calculation formulas that can be used are as follows:

Exp(x)Acos(-0.1)
Floor([ActualCost])Asin(0.1)
Ceiling([ActualCost])Atan(0.1)
Cos([ActualCost])Exp(x) x < 50
Sin([ActualCost])Floor([ActualCost])
Sqrt([ActualCost])Ceiling([ActualCost])
Tan([ActualCost])Cos([ActualCost])
Truncate([ActualCost])Sin([ActualCost])
Round([ActualCost], 2)Sqrt([ActualCost])
Log([ActualCost], 2)Tan([ActualCost])
Log10([ActualCost])Truncate([ActualCost])
Ln([ActualCost])Log([ActualCost], 2)
IEEERemainder([ActualCost],1)Log10([ActualCost])
Abs(-[ActualCost])Ln([ActualCost])
Acos(-0.1)IEEERemainder([ActualCost],50)
Asin(-0.1)Abs(-[ActualCost])
Atan(-0.1)Acos(-0.1)
Max([ActualCost], [ActualDurationSeconds])Asin(-0.1)
Min([ActualCost], [ActualDurationSeconds])Atan(-0.1)
Sign(-10)Max([ActualCost], [ActualDurationSeconds])
if(in(58, [ActualCost], [ExpectedCost], [ActualDurationSeconds]), 1, 2)Min([ActualCost], [ActualDurationSeconds])
Ifs([ActualCost] > 50, 'bar', [ExpectedCost] > 75, 'baz', 'quux')if(DateDiff('mm', [Date], DateAdd('mm', 2, Now())) > 1, 'Mais que um mes', 'Menos que um mes')
Cos([ActualCost])DateDiff('mm', [Date], DateAdd('mm', 1, Now()))
Sin([ActualCost])DateAdd('yy', 5, [Date])
Sqrt([ActualCost])DateAdd('yy', -5, [Date])
Tan([ActualCost])DateAdd('dd', 15, DateAdd('mm', 8, DateAdd('yy', -5, [Date])))
Log([ActualCost], 2)Month(Now())
Log10([ActualCost])Year(Now())
Ln([ActualCost])Day(Now())
Substring(Now(),4, 4)
Substring('Concat'('TESTEOS1234',Now()),4, 20)