Hello Experts,
I am creating work order from dynamics 365 portal. IN work order create form i have a field which has customer lookup which i prepopulate by querying current logged user and getting its related account. When i save record this field remains blank. Can anyone suggest what i am missing?
*This post is locked for comments
Hi Arpit, thanks for the reply. I could achieve it by creating a new field and then prepopulate as per mentioned above. Still wondering what went wrong with previous field.
Hi Drashti,
There is surely something going wrong in your side. Because this is very straight forward requirement and easily achievable without using code.
As I suggested above, yes you can try to autopulate the value on Save "Set Value on Save" using Entity Form Metadata.
Regards
Arpit
Thanks Arpit, but this is throwing me required field validation error so i guess it is not setting up this lookup value only. Just out of curiosity, do i need to set "Set Value on Save" for this account field to save it. Actually i tried to but could not get it.
Hi Drishti,
Ideally, it should have work with Entity Form Metadata only. But I am not sure about your configuration or script. Anyways take the help of following code, you don't need to query in order to get loggedIn user's account information. Paste the code in Custom javascript section (Webpage/Entity Form). change the bold red text with your lookup control ids.
$(document).ready(function(){
var loggedInUserAccountId = '{{ user.parentcustomerid.Id }}';
var loggedInUserAccountName = '{{ user.parentcustomerid.Name }}';
$("#retailer_name").attr("value",loggedInUserAccountName);
$("#retailer_id").attr("value",loggedInUserAccountId);
$("#retailer_entityname").attr("value","account");
});
How to set value in Portal Lookup Field - http://arpitmscrmhunt.blogspot.in/2016/09/adxstudio-set-values-in-lookup-fields.html
If found useful, please mark the answer as verified.
Cheers
Arpit
https://arpitmscrmhunt.blogspot.com
Here is what i am trying to explain. As per above image, I have Retailer field which stores account records. I want to pre fill with logged in user account (not contact). On saving the record this field remains blank as shown below.
Hi Arpit,
Thank you so much for the response, but i have requirement as such to pre fill the field by logged in user account . And for point 1&2, there is no any such issue in it. And since my field stores account value in crm so prepoulating it with parentcustomerid would also not work out.
Hi Drishti,
Make sure,
1.There is no custom javascript creating issue to making the lookup value blank on your webpage/Entityform.
2.Field should not be disabled on CRM form.
3.Try to populate the value on Save instead of Prepopulate on load using Entity Form Metadata itself. Just to check no script is creating issue.
4. Check is there any error in Console.
Thanks
Arpit
Hi Arpit,
I had tried it before but it did not work out in my case. On saving the record, it remains blank only.
Thanks and Regards,
Drashti Mehta
Hi Drashti,
You don't need to query in order to auto-populate the Logged In User's Account in Order form Customer field.
You can achieve the using Entity Form Metadata:
Open your Entity Form and Go Down, you will find Entity Form Metadata Subgrid:
Create a New Entity Form Metadata in order to auto-populate the Logged In User's Account in Customer field.
Select 'Customer' Field of Order Entity instead of Company Name (Below screen is for demo purpose)
Choose 'Company Name' field in 'From Attribute' dropdown.
If you find the answer useful, please mark it as verified
Cheers
Arpit
https://arpitmscrmhunt.blogspot.in
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156