Hi,
We have a user which is linked to a account, but this account is the parent Account for multiple other accounts.
When the user logs in, he needs to select which 'subaccount' he wants to use as filter for different lists.
For the subaccount selection, we have build a dropdown list with the following code:
{% fetchxml accounts %}
<fetch mapping='logical'>
<entity name='account'>
<attribute name='accountid'/>
<attribute name='name'/>
</entity>
</fetch>
{% endfetchxml %}
<form id="myForm">
<select id='subAccountOptions' name='selectedOption'>
{% for result in accounts.results.entities %}
<option value="{{result.name}}">{{result.name}} </option>
{% endfor %}
</select>
</form>
<div>
<span id="selectedValue"></span>
</div>
<script>
subAccountOptions.addEventListener("change", function() {
var selectedOption = document.getElementById("subAccountOptions").value;
document.getElementById("selectedValue").textContent = "Selected Value: " + selectedOption;
localStorage.setItem("selectedOption", selectedOption);
})
</script>
So we saved the selected value(subaccount) in the local storage.
But now we need the selected value as a filter, does anyone know how to use the selected value as filter?