Yes/No Boolean datatype Environment Variables do not update from settings file.
I have tested this with different values using the latest version of pac cli.
I have a single test solution. Within this solution I have an Environment Variable with the Boolean data type "Yes/No" - this value is set at the default: no
There is only a default value. I can see in the envrionmentvariabledefinition entity, in the defaultValue field that the value is either yes or no - in lowecase and appears to be just text.
When importing the solution with pac cli and the --settings-file option I am unable to set the value for this type of Environment Variable.
I have tried:
{
"EnvironmentVariables": [
{
"SchemaName": "kd_danstylesboolean",
"Value": "yes"
}
],
"ConnectionReferences": []
}
I tried:
{
"EnvironmentVariables": [
{
"SchemaName": "kd_danstylesboolean",
"Value": "Yes"
}
],
"ConnectionReferences": []
}
I also tried:
{
"EnvironmentVariables": [
{
"SchemaName": "kd_danstylesboolean",
"Value": 1
}
],
"ConnectionReferences": []
}
I even tried:
{
"EnvironmentVariables": [
{
"SchemaName": "kd_danstylesboolean",
"Value": true
}
],
"ConnectionReferences": []
}
I also tried the negatives of the above (No, false, 0, etc) and was unable to set the value of one of these Environment Variable types.
Thanks a lot and kind regards. DS
Hello - Have you looked at this link: https://learn.microsoft.com/en-us/power-platform/alm/conn-ref-env-variables-build-tools
Please double check your environment variables in 'Default' solution and your new solution.
Thanks - I have looked at the link many, many, many times.
The image below is prior to setting value with pac cli and a settings file. See image below.
Here is the settings file:
Here i run the command:
Here we see the solution has imported:
I dont even NEED to look in the default solution - I can view the contents of this record from powershell:
We can see the default value has NOT been set. there is not a current value. For further verification i will now screenshot the variable in the default solution:
The value, as specified in the settings file.. has NOT been set.
However, if I do it like this:
> $EV = Get-CrmRecord -conn $conn -EntityLogicalName environmentvariabledefinition -Id $recID -Fields schemaname,defaultvalue
> $EV
defaultvalue_Property : [defaultvalue, no]
environmentvariabledefinitionid : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
logicalname : environmentvariabledefinition
schemaname_Property : [schemaname, kd_danstylesboolean]
original : {[schemaname_Property, [schemaname, kd_danstylesboolean]], [schemaname, kd_danstylesboolean], [defaultvalue_Property, [defaultvalue, no]], [defaultvalue, no]...}
ReturnProperty_EntityName : environmentvariabledefinition
EntityReference : Microsoft.Xrm.Sdk.EntityReference
ReturnProperty_Id : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
environmentvariabledefinitionid_Property : [environmentvariabledefinitionid, c82cf57b-7058-4cd3-b7c3-a57949ac6b0e]
defaultvalue : no
schemaname : kd_danstylesboolean
> $EV.defaultvalue="yes"
> $EV
defaultvalue_Property : [defaultvalue, no]
environmentvariabledefinitionid : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
logicalname : environmentvariabledefinition
schemaname_Property : [schemaname, kd_danstylesboolean]
original : {[schemaname_Property, [schemaname, kd_danstylesboolean]], [schemaname, kd_danstylesboolean], [defaultvalue_Property,
[defaultvalue, no]], [defaultvalue, no]...}
ReturnProperty_EntityName : environmentvariabledefinition
EntityReference : Microsoft.Xrm.Sdk.EntityReference
ReturnProperty_Id : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
environmentvariabledefinitionid_Property : [environmentvariabledefinitionid, c82cf57b-7058-4cd3-b7c3-a57949ac6b0e]
defaultvalue : yes
schemaname : kd_danstylesboolean
> Set-CrmRecord -CrmRecord $EV
>$EV = Get-CrmRecord -conn $conn -EntityLogicalName environmentvariabledefinition -Id $recID -Fields schemaname,defaultvalue
>$EV
defaultvalue_Property : [defaultvalue, yes]
environmentvariabledefinitionid : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
logicalname : environmentvariabledefinition
schemaname_Property : [schemaname, kd_danstylesboolean]
original : {[schemaname_Property, [schemaname, kd_danstylesboolean]], [schemaname, kd_danstylesboolean], [defaultvalue_Property, [defaultvalue, yes]], [defaultvalue, yes]...}
ReturnProperty_EntityName : environmentvariabledefinition
EntityReference : Microsoft.Xrm.Sdk.EntityReference
ReturnProperty_Id : c82cf57b-7058-4cd3-b7c3-a57949ac6b0e
environmentvariabledefinitionid_Property : [environmentvariabledefinitionid, c82cf57b-7058-4cd3-b7c3-a57949ac6b0e]
defaultvalue : yes
schemaname : kd_danstylesboolean
We see it change AND I can now see the value reflected in the default solution.
I trust this is now enough information to log this as a bug. this is not a case of user error and i have quite thoroughly investigated it. Kind Regards DS