Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Updating accounts - MS CRM 2013 4 106
Microsoft Dynamics Management Reporter: When to Rebuild the Data Mart 1 248
Dynamics CRM 2016 - Auto-numbering 2 105
Dynamics crm 2011 8 89
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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