Overview
This article shows how to get the global default value of a parameter within a CB plug-in
Considerations
You have a parameter name ‘test_test' with a global default as ‘my value’ configured in the UI like:
Procedure
Step 1 Import required modules
from behavior_mapping.models import CustomFieldMapping
Step 2 Get the CustomFieldMapping of the parameter like:
cfm=CustomFieldMapping.objects.get(custom_field__name='test_test', default__isnull=False)
Step 3 Get the default
cfm.default
Out[11]: <CustomFieldValue: test = myval>
Step 4 Get the default value:
cfm.default.value
Out[12]: 'myval'
0 Comments