Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Not able to save record of customer lookup on creating work order record in portal

Posted on by 260

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

  • Verified answer
    Drashti Mehta Profile Picture
    Drashti Mehta 260 on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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.

  • Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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

  • Drashti Mehta Profile Picture
    Drashti Mehta 260 on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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.

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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

     

  • Drashti Mehta Profile Picture
    Drashti Mehta 260 on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    z2.PNG

    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.

    z2.PNG

  • Drashti Mehta Profile Picture
    Drashti Mehta 260 on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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.

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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

  • Drashti Mehta Profile Picture
    Drashti Mehta 260 on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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

  • Verified answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Not able to save record of customer lookup on creating work order record in portal

    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:

    1134.2.PNG

    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)

    1134.2.PNG

    Choose 'Company Name' field in 'From Attribute' dropdown.

    75532.3.PNG

    If you find the answer useful, please mark it as verified

     

    Cheers
    Arpit
    https://arpitmscrmhunt.blogspot.in

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans