Answered by:
Create a lnk to a field

Question
-
I have a form for equipment and one of the fields has a UNIT number, I would like to create a link to this unit number that opens up a folder where there will be cost sheets, spec sheets and other documents for this piece of equipment.
Any suggestions?Thanks Joe
Sunday, May 1, 2011 11:16 PM
Answers
-
Thanks for the suggestion. One of my main issues is that this solution I'm tring to do is not the best,
I have to import the data from my ERP then delete the import when I'm ready to import the updated information and the most consistance recort is the unit number (new_unitnumb). I have folders on a network share called \\team\truckinfo\(new_unitnumb) that is where the var FolderName = "\\team\truckinfo\" + Xrm.Page.getAttribute(new_unitnumb).getValue(); comes into play.
I get an Iframe error even before I get to to the FolderName.
- Marked as answer by j_ttc Thursday, July 21, 2011 6:17 PM
Monday, May 16, 2011 6:27 PM
All replies
-
Before I answer your question, let me ask why you want to have the info in a folder. Why not store the info within CRMs Sales Literature or within SharePoint? All you would have to do is create a URL field, set the value to the correct URL and you're done.
However, if you do want to create a link to a (network) folder than you can try with this previous post: http://social.microsoft.com/Forums/en/crm/thread/2257c48b-a80f-48a7-9817-48db3c83277d
- Proposed as answer by Bertil Deuring Monday, May 2, 2011 12:46 PM
Monday, May 2, 2011 12:46 PM -
I need a folder because I delete and import the records from our ERP once a day because of updates that are done, thus breaking links to files. So I thought if I could somehow create a link by using the UNIT number field it would be easier as it never changes and the File has the same share name as the unit number. We are currently looking to implement SCRIBE so we can link directly to our ERP and save the Import function.
Thanks Joe
Monday, May 2, 2011 4:20 PM -
In that case you could go with a solution like described in the link I posted. You would just have to make the var that has the complete link dependent on the field with the UNIT number field. Something like: var FolderName = "\\somedrive\somefolder\" + crmForm.all.new_unitnumber.DataValue;
Good luck
Tuesday, May 3, 2011 8:35 AM -
Sorry to be a pain ...I did what you have told me to. When I created the tab it wants a URL and all I put in there was \\team\ because it's the network share where I have these folders .
I get an error when the page loads that says
There was an error with this field's customization event
Field:window
Event: OnLoad
Error: object expected
Here is the code I added
function Form_onload()
{
if(crmForm.all.tab3Tab != null)
{
crmForm.all.tab3Tab.onclick = FolderView;
}
function FolderView(){
var FolderName = Xrm.Page.getAttribute("\\team\truckinfo\" + crmForm.all.new_unitnumb).getValue();
if(FolderName != null)
{
document.all.IFRAME_FolderView.src=FolderName;
}
}Tuesday, May 3, 2011 2:16 PM -
Hi, no problem.
function Form_onload()
Last time I tried something similar was in CRM 3.0 days... Didn't check for CRM 2011 yet. But if I read your script correctly it has some errors. You're using CRM 3.0/4.0 (that's what the original script is made in) and 2011 style javascript in one and the same function. What do you use? CRM 4.0 or 2011? Most obvious error is in the line where you create the folder var. It should be "fixed path part" + variable field value. I've changed your functio to:
{
if(crmForm.all.tab3Tab != null)
{
crmForm.all.tab3Tab.onclick = FolderView;
}
function FolderView(){
var FolderName = "\\team\truckinfo\" + Xrm.Page.getAttribute("new_unitnumb").getValue();
if(FolderName != null)
{
document.all.IFRAME_FolderView.src=FolderName;
}
}
Tuesday, May 3, 2011 2:51 PM -
Thank you very much, I'm using 2011 online version.
I replaced the script and I still get the same error. Now when I created the tab it wanted a URL so I just added \\team\ do you think that might be my issue?
Tuesday, May 3, 2011 3:10 PM -
Looks like it's trying to go to a website "https://team/truckinfo/ . do you know how Ican change this so it goes to a shared folder instead?
Thanks Joe
Wednesday, May 4, 2011 1:19 PM -
Hi,
I had this working once in the early CRM 3.0 days. Just now I tried it in CRM 2011 with some adjustments but it also doesn't work:
function FolderView()
{
if(Xrm.Page.getAttribute("new_name").getValue() != null)
{
var FolderName = "C:\\temp\\" + Xrm.Page.getAttribute("new_name").getValue();
alert(FolderName);
if(FolderName != null)
{
var IFrame = Xrm.Page.ui.controls.get("IFRAME_Folder");
IFrame.setSrc(FolderName);
//IFrame.setSrc("http://www.bing.com");
}
}
}
If I use it to IFrame Bing (or any other webpage) it's no problem. Quickly Binged for a solution but it seems that showing a directory doesn't work in IE anymore. As far as I understand it has something to do with security. I may be wrong here and would gladly hear if anybody has a solution.
Bertil
Thursday, May 5, 2011 10:28 AM -
I mapped a shared drive and it seems to work a bit but I still get an object error plus an https: error but after clicking the errors I do see the complete directory but not the the exact path that I would like to see.
Saturday, May 7, 2011 6:01 PM -
"I'm using 2011 online version" Since you are using CRM Online, it would be easier if you could create a folder on a website that has internet access then give the unit link the URL to that folder.
Monday, May 16, 2011 12:46 AM -
Thanks for the suggestion. One of my main issues is that this solution I'm tring to do is not the best,
I have to import the data from my ERP then delete the import when I'm ready to import the updated information and the most consistance recort is the unit number (new_unitnumb). I have folders on a network share called \\team\truckinfo\(new_unitnumb) that is where the var FolderName = "\\team\truckinfo\" + Xrm.Page.getAttribute(new_unitnumb).getValue(); comes into play.
I get an Iframe error even before I get to to the FolderName.
- Marked as answer by j_ttc Thursday, July 21, 2011 6:17 PM
Monday, May 16, 2011 6:27 PM