Hi @yogiz
For now we pulled out views and forms functionality from the base plugin as we’re still working on the implementation and deployment details. I am aware that the documentation is yet to catch up, sorry about that.
Having said that, the only thing that views do for you is the retrieval of the metadata at runtime. You can easily do it yourself using either direct record access or FetchXML. (And you can pull fetchxml from the view definition yourself if you want to make it truly dynamic)
Thanks
George
Thread Starter
yogiz
(@yogiz)
Hi George,
Thanks for your answer.
I have actually tried the workaround using FetchXML and this works fine as long as there are no lookup fields inside the display section.
I use the display source code example in your documentation just with my own entities.
eg: <li>{{record["name"]}}</li>
This works fine but when I try to display a lookup
<li>{{customer["accountid"]}}</li>
I cannot even save the page as I receive an Invalid JSON error.
What am I doing wrong here?
Hi @yogiz
can you send through the complete twig code you’re using?
Thanks
George
Thread Starter
yogiz
(@yogiz)
Sure:
{% fetchxml collection="offers" %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="fsm_offer">
<attribute name="fsm_offerid" />
<attribute name="fsm_name" />
<attribute name="fsm_account" />
<order attribute="fsm_name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
{% endfetchxml %}
<ul>
{% for offer in offers.results.entities %}
<li>{{offer["fsm_account"]}}</li>
{% endfor %}
</ul>
fsm_account is a lookup to the Account entity
when I use
<li>{{offer["fsm_name"]}}</li>
it works no problem
Thread Starter
yogiz
(@yogiz)
Hi George,
Any advice on how to resolve the above?
Much appreciated.
Regards,
Jurgen
Jurgen,
account is a lookup and the display name will be Name property of the lookup (entity reference). That should work: <li>{{offer["accountlookupattributename"].Name}}</li> or even <li>{{offer.accountlookupattributename.Name}}</li>
(not sure from your sample code what your lookup attribute name is, looks like fsm_account but I’m not sure)
HTH
George
-
This reply was modified 5 years, 6 months ago by
alexacrm.
Thread Starter
yogiz
(@yogiz)
Hi George,
Any idea when views and forms will be available?
I know in the meantime we can use Custom Forms, I am just wondering how I would populate a lookup (entityreference) since it is compromised of 3 parts (entityname, logicalname and GUID)
Looking at the D365 Plugin I could define a default. I have tried
{% form entity="fsm_offertocustomer" mode="create" default="fsm_offerid": { "LogicalName": "fsm_offer", "Id": "68EA116A-C304-EB11-A813-000D3A4A1F88", "DisplayName": "Free Beer" } %}
But this is not working. The record is being created but the lookup field fsm_offerid is empty.
Hi @yogiz
views and forms will become part of the premium and we’re currently in the beta stage. You can always retrieve the definitions and build those in twig yourself.
{% form %} tag works with the custom layout and in that layout you’ll have a field (hidden or visible) that maps to fsm_offerid. Just set it explicitly in the layout.
HTH
George