Notifications
Announcements
No record found.
I am assuming I will need JS for this so could someone help me develop a web resource that targets a lookup and opens the lookup record in a new widow or tab on click.
*This post is locked for comments
Hi
first learn how to create a button and associate to a JS inside a form.
[View:http://himbap.com/blog/?p=1473]
Next, learn how to get lookup id and entity name
[View:https://arunpotti.wordpress.com/2014/12/19/get-lookup-id-text-entityname-in-crm-using-javascript/]
After that, learn how to get field type
[View:https://msdn.microsoft.com/en-us/library/gg334266.aspx#]
finally, learn how to open record
[View:https://msdn.microsoft.com/en-us/library/jj602956.aspx#BKMK_OpenEntityForm]
So I am not using a button I am using the actual lookup value it’s self. I am agile to target the value and open the record. I tested it by opening another lookups record using another lookups value. The only thing I can’t get working is the new window part and I followed what Microsoft recommends.
Any ideas? I will post the code tomorrow.
function openLookupNewWindow(){ $("#customerid").children().find("span.ms-crm-Lookup-Item").click(function(){ var options = {openInNewWindow: true}; var type = Xrm.Page.getAttribute("ic_regardingorganizationid").getValue()[0].id; Xrm.Utility.openEntityForm("account", type, null, options); });}
Hi,
from the code you shared, it seems you are using unsupported code, are you sure you want to do it that way, it could be not working after you migrate to next version in future.
I will do it like this for now and possibly migrate the code to an inline button once its working. Still I am unable to open in a new window... Does my code look correct?
Hi ,
i double check my code, it is working as expected. The below is my code.
function SetHyperlink(){ var currentControl = Xrm.Page.ui.getCurrentControl();
if (currentControl == null) { alert("No controls currently have focus."); } else { if (currentControl.getControlType() == "lookup") { var controlname = currentControl.getName(); var controlvalue = new Array(); var EntityType =""; var id= ""; controlvalue = Xrm.Page.getAttribute(controlname).getValue();
if(controlvalue !=null)
{ EntityType = controlvalue[0].entityType; id = controlvalue[0].id; var windowOptions = {openInNewWindow: true}; Xrm.Utility.openEntityForm(EntityType,id,null,windowOptions); } else { alert("Lookup field does not contain value, Please provide a value"); } } } }
Please chek below link:
crmpolataydin.wordpress.com/.../crm-2013-open-entity-form-in-new-window-by-javascript
Thanks:)
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2