cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UmerJaved
Helper III
Helper III

Dynamics 365 Portal - Entity list set lookup value on create mode

 

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)?

 

SetResource.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

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/

 

 

View solution in original post

15 REPLIES 15
hardikv
Super User
Super User

Hi @UmerJaved 

 

You can achieve your requirement by creating a workflow on create of "Resource Forecast" entity. You have to update Bookable Resource field from Contact field.

Hi @hardikv 

 

Workflow won't execute until the record is saved whereas in our case we want to set the value as soon as the Create button is clicked therefore form is loaded. 

 

Hi

 

you can achieve that via JS 

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi @OliverRodrigues 

 

Thanks. As per your first link shared, the Odataset and views is the same as entity list whereas in my scenario, the entity list is a different entity(Resource Forecast). And the 2 lookups required to be set on the create form for Resource Forecast are from different entities (Resource and Contact). So I am not sure if suggested solution in the link would work here?

it's not a problem if it is the same entity.. I am not sure if you can use the same Entity List though, I would create 2 different Entity List records.. one to be shown in the Portal.. other with the oData flag enabled

 

via oData you will retrieve the record ID.. so via JS you can populate your lookup with the record ID 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi @OliverRodrigues 

 

 

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.Lookup.PNG

 

ResourceDetail.PNGCreateForm.PNG

Hi @UmerJaved

You have to put liquid code in single quotein javascript.

$("#ao_fieldname").val('{{result.name}}');

you can add custom code to validate fields on the submit button.. I guess that's the best place to put your logic

 

https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript#additional-...

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi @OliverRodrigues 

 

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.Capture.PNG

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (1,524)