Solved

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

Posted on 2012-04-06
4
1,556 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

20 Experts available now in Live!

Get 1:1 Help Now