Sunday, 20 August 2017

Hyperlink on Lookup Values in CRM Portal




Hello Friends,

From last couple of days, I came across so many forums and communities and found so many folks are looking for a way to open lookup selected values in Portal so that users can see easily the details of lookup selected values.

Extending CRM lookup functionality to ADX portal gives users an rich experience in terms of user interface/functionality. However not all fields behave same in Dynamics CRM and ADX portal, look-up control being one such example. When viewed on ADX Portal form, look-up doesn't allow users to open up a new window giving details about the selected lookup value like CRM.

Today In this article I am going to share the code through which we can open the lookup selected value in portal.


Step 1 - Download the JS file from this link.

Step 2 - Create a Web File record (Portals > Web Files) with below details. And attach JS file (downloaded in Step 1) in Notes.




Step 3 - Create Entity Form in Edit Mode to view the lookup value. See below link to create Entity Form in Edit mode.

https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/entity-form/


Step 4 - Use below code on Webpage Custom JavaScript section to Open Lookup Selected Values.


$(document).ready(function () {

//Parameter Description:

//Parameter 1   -   Lookup Html input element which store lookup text (can get it by doing F12)
//Parameter 2   -   Lookup Html input element which store lookup guid (can get it by doing F12)
//Parameter 3   -   Partial Name of webpage which is associated with Entity Form (Created in Step 3 Edit Mode)
//Parameter 4   -   location where you want to open new window to view lookup record (_self/_blank)


















 $.getScript('~/openlookuprecord', function () {

 openLookupRecord("case_name","case","Edit-Entity-Form-Webpage","_blank");
     
});

});





Step 5 - Open the webpage On Portal. As soon as you will select the lookup value, you will get Hyperlink over the value. Now when you click on Lookup value you will be redirected to Details Page.













Best part of this code is, its totally configurable. After attaching the JS file in Web File record, you just need to call openLookupRecord function.

Please feel free to get in touch in case of any query. Cheers 😃

7 comments:

  1. if I set the lookup field to read-only. The function is not work. Do you have any solution for this case? Thank you!

    ReplyDelete
    Replies
    1. Hi, even i wanted to implement this on a readonly lookup..is there a way out for this.

      Delete
    2. It's a quite old post. I have designed a new control for the same.

      Please have a look "Portal Lookup Editor Control" -

      https://arpitmscrmhunt.blogspot.com/2020/07/powerapps-portals-lookup-editor-control.html

      Delete
    3. It's a quite old post. I have designed a new control for the same.

      Please have a look "Portal Lookup Editor Control" -

      https://arpitmscrmhunt.blogspot.com/2020/07/powerapps-portals-lookup-editor-control.html

      Delete
  2. Hello Arpit,

    When im trying to add the js file to the notes its throwing a error invalid file type. please suggest

    ReplyDelete
    Replies
    1. Hi,

      This is due to .Js file extension is blocked in your D365 System Setting.

      To allow it, Navigate to Settings > Administration, open System Settings and within the Set blocked file extensions for attachments, add the js extension with a semi-colon

      Or have a look following article for more info:

      https://colinvermander.com/2017/05/17/dynamics-365-portals-javascript-as-web-files/

      Hope it helps.

      Thanks

      Delete
  3. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to

    (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time.

    Contact him now and thank me later.

    ReplyDelete

Blogger Widgets