Solved

CRM 2011 - Reference Javascript Web Resource from another Javascript Web Resource

Posted on 2012-04-06
4
1,590 Views
Last Modified: 2012-04-06
I have download a XrmServiceToolkit.js and create a Web resource called XrmServices.
I would like to call the function of XrmService within another JavaScript Web Resource?
Can it be done? Or any reference you can suggest for a step by step how to do this.  Thanks.
0
Comment
Question by:tommym121
  • 2
  • 2
4 Comments
 
LVL 27

Assisted Solution

by:Chinmay Patel
Chinmay Patel earned 500 total points
ID: 37817582
Hi tommym121,

It can be easily done.

First, refer to this article : http://blogs.msdn.com/b/lezamax/archive/2010/10/21/crm-2011-web-resources-simulating-directories-and-the-importance-of-relative-paths.aspx

Basically all you need to do is refer to XrmServiceToolkit's features in your scripts and html files and make sure that on the form where you call your web resource, xrmservicetoolkit.js is also available.

Just make sure that you use $webresource directive so that you can always track component dependencies.

Regards,
Chinmay.
0
 

Author Comment

by:tommym121
ID: 37817816
Chinmay,

I am not 100% sure what I need to do.  I have created the web resource for XrmServiceSdk.
It has a function to retrieve the field value by calling XrmServiceSdk,GetFieldValue('LogicalName')
What I am trying to create another function (not in XrmServiceSdk Web Resource but rather another Web resource) that will combine the values from FirstName and LastName.  Something like below
Function combineFieldsValue (val1, val2)
{
       combineFieldsValue = val1 + ' ' + val2;
}
This function will be call in the OnChange event of a field in the form.

Can I do that?  Or I really have to add a function into the XrmServiceSdk since Javascript do not allow #include type.

Hope you can clear up my confusion.  Thanks.
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 37817850
Hi tommym121,


Sure. Basically, you call this function as if it is already available to you.
Just on the form where you add your script libraries, make sure to add XrmServiceSDK's js also.

Regards,
Chinmay.
0
 

Author Closing Comment

by:tommym121
ID: 37818058
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now