serviceup.png

Custom module ValuesCountApprovedAndDisapproved

This module counts the number of times a given value has been added to a dynamic field.

To do this, go to the Administrative menu and go to the option "Generic Agent".

Give the agent a name and make the settings as desired to trigger the event.

enter image description here

Run

Custom Module:

Module                          => Kernel::System::GenericAgent::DFValuesCount::ValuesCountApprovedAndDisapproved
FieldNameApprovedAndDisapproved => Name of the suspended dynamic field that will have keys to be counted as approved or disapproved.
FieldNameToCountApproved        => Dynamic text field name that counts the amount of approved votes (number of times key in 'ApprovedKey' field was selected)
FieldNameToCountDisapproved     => Dynamic text field name that counts the value of disapproved votes (number of times key in 'DisapprovedKey' field was selected)
ApprovedKey                     => Dynamic field key pointed to 'FieldNameApprovedAndDisapproved' field to be considered Approved.
DisapprovedKey                  => Dynamic field key pointed to 'FieldNameApprovedAndDisapproved' field to be considered as disapproved.

Obs:

The dynamic field value pointed to in the 'FieldNameApprovedAndDisapproved' field is also cleared for each generic agent interaction.

enter image description here

Save the changes and implement the settings.

Now, whenever the pointed event occurs, depending on the key chosen in the 'FieldNameApprovedAndDisapproved' field, the 'FieldNameToCountApproved' or 'FieldNameToCountDisapproved' fields will be incremented.

In the example below, choosing 'Yes' (that in the generic agent would be the field ApprovedKey) in the field 'Yes or No' (in the generic agent would be the field FieldNameApprovedAndDisapproved) and send:

enter image description here

The 'Approved' field (which in the generic agent would be the FieldNameToCountApproved field) is incremented:

enter image description here