Hi,
We have 1-M relationship between Contact and Resource Entity. When click "Create" on "Resource Forecast" entity list page, the contact gets set to the login user however we also want to be able to by default set equivalent resource lookup value. Every portal contact is also set as Resource in CRM.
I wonder if we need FetchXML or WebAPI call in Entity list to only execute when "Create" is clicked therefore pass contact guid and retrieve equivalent Resource record from CRM and set the lookup value here (screenshto attached)?
Hi @bobf,
Yes it did work eventually. I had to use fetchxml in a template to retrieve the resource record. Then in my entity form I had to use Javascript make fetchml call by passing login contact id. The following article helped me to achieve the desired results.
https://www.dancingwithcrm.com/custom-lookup-filtering-powerapps-portal/
@bobf this seems to be an old thread, can you please create a new one and give more details of your issue?
Did you ever get around this, I am trying to get exactly the same up and running.
Hi @hardikv and @OliverRodrigues
I managed to tidyup the JavaScript and liquid into the correct format therefore added into Custom JavaScript section of my Entity form. However the lookup value still doesn't seem to be set. I am wondering if we need to make explicit WebAPI call here?
Thanks @hardikv . It is Entityform(insert mode) in my scenario when create is clicked from entity list. Can I add javascript and liquid both in custom javascript section under "Additional Settings" in entityform therefore set my lookup? Apparently liquid tags don't seem to be recognised here and I get expression errors:
Hi @UmerJaved
If you want to put javascript then you have to put javascript in Web Page's localized content page for your requirement.
It seems that you are adding javascript in Entity List, that is wrong place to put javascript for your requirement.
If you have created a Web Page for create a record, then put javascript in localized content of webpage.
If you have created a Web Form for create a record, then put javascript in Entity Form record(Additional Settings Tab -> Custom JavaScript).
I guess it is moreover setting a value on load of the create form instead of submit of the form. Can we use custom javascript section in entity list form therefore use Fetchxml query/liquid and checking if the create button is clicked therefore set the lookup value? Screenshot attached.
you can add custom code to validate fields on the submit button.. I guess that's the best place to put your logic
Hi @UmerJaved
You have to put liquid code in single quotein javascript.
$("#ao_fieldname").val('{{result.name}}');
I'll look into the option you suggested. However I have written FetchXML in a web template therefore able to retrieve the Guid from the resource record (attached screenshot).
Now the question how do I setup the resource lookup value on the create form so it is only set when "Create" is clicked from the entity list web page? I tried to setup the lookup value in web template within Fetch XML result however it didn't work.
stampcoin
11
Muzammil Nawaz
8
Ajlan
8