Hi community, I managed to implement the following article in my portal: https://www.dancingwithcrm.com/custom-lookup-filtering-powerapps-portal/
This is the liquid template that returns the results in JSON format:
{% assign pricelist = request.params.pricelist %}
{% fetchxml articulos %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="crd4f_mkt_elementoslistaprecios">
<attribute name="crd4f_mkt_elementoslistapreciosid"/>
<attribute name="crd4f_idelemento"/>
<attribute name="crd4f_idarticulo"/>
<attribute name="crd4f_idlistaprecios"/>
<attribute name="crd4f_descripcion"/>
<attribute name="crd4f_precio"/>
<filter type="and">
<condition attribute="crd4f_idlistaprecios" operator="eq" value="{{pricelist}}" />
</filter>
</entity>
</fetch>
{% endfetchxml %}
{% if articulos.results.entities.size > 0 %}{
"results":
[
{% for articulo in articulos.results.entities %}
{
"Id": "{{articulo.crd4f_mkt_elementoslistapreciosid}}",
"Elemento": "{{articulo.crd4f_idelemento}}",
"Articulo": "{{articulo.crd4f_idarticulo}}",
"Descripcion": "{{articulo.crd4f_descripcion}}",
"Lista_precio": "{{articulo.crd4f_idlistaprecios}}",
"Precio": "{{articulo.crd4f_precio}}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
{% else %}
No data found.
{% endif %}
And this is the JavaScript that the form has:
$(document).ready(function () {
var listprice = "{{user.crd4f_listaprecios}}";
console.log("ListPrice " + listprice);
// remove all option from dependent field
$("#crd4f_clavearticuo").empty();
if(listprice != null && listprice !=""){
// request to our custom page with id as parameter
$.getJSON("/pedido/json-articles/?pricelist="+listprice, function(data) {
if(data.results.length>0){
//create option for each returned entity
data.results.forEach(element => {
let option = document.createElement("option");
option.value = element.Id;
option.innerText = element.Descripcion;
console.log(option);
$("#crd4f_clavearticuo").append(option);
});
}
}
);
}
});
At the time of sending the data of this form and with its respective quantity and selected article key,
it throws me the following error:
Sorry, an error appears to have occurred. He try again. If the problem continues, contact the website administrator.
ID no. error [7283f720-3007-4540-b5b4-e161e3791a56]
We have been notified of this issue and will discuss it shortly. Thank you for your patience.
01/12/2022 23:44:13 UTC
NAM 920e9d2f-d95f-4f84-ae18-f4d406f75452
It's funny, because sometimes this form is sent correctly.
Can you help me here?
I would appreciate it Guys.

Report
All responses (
Answers (