How to create button with javascript in CRM40 ?

In CRM30 I had a button with some javascripting in behind.

In the isvconfig file this was added within the right entity:

....
<Buttons>
            <Button Title="Submit TS" ToolTip="Submit TS" 
Icon="/_imgs/ico_16_2020.gif" JavaScript="submitTS();" />
</Buttons>
....

In the \_common\scripts\global.js this function was added:

function submitTS()
{
	var SubmitTSUrl;
	var selectedCount;
	var selectedState;
	SubmitTSUrl="http://192.168.14.10/TS/SubmitTS.aspx?";
	selectedCount=0;
	selectedState="";
	var _objRows = document.getElementById('gridBodyTable').rows;
 	for( var i = 0; i < _objRows.length; i++ )
  	 {
		if(_objRows[i].className != 'grid')
		{
			SubmitTSUrl+="&oId=" + _objRows[i].oid;
			selectedCount++;
			selectedState=_objRows[i].cells[4].innerText;
		}
	}
	if (selectedCount!=1)
	{
		alert('Please select only one TS at a time from the list');
	}
	else
	{
		if (selectedState=="Submitted" || selectedState=="Approved")
		{
			alert('This TS cannot be submitted again.');
		}
		else
		{
			window.open(SubmitTSUrl, null, 'height=350px, width=440px, resizable=yes, 
status=yes, toolbar=no, center=yes, scrollbar=no');
		}
	}
}


Remind that this worked in CRM 30.



So I upgraded the CRM30 to CRM40.

When I click on the button I get a javascript error.

I wanted to check the javascript in the global.js file, but, i only found a 
global.js in the following directory :
\_static\_common\scripts\        WITHOUT my javascript.


Is this because of the upgrade? (unsupported coding?)

Or is there an other way to add javascripting?
When I do this in Crm40, it gives an alert.
....
<Buttons>
            <Button Title="Submit TS" ToolTip="Submit TS" 
Icon="/_imgs/ico_16_2020.gif" JavaScript="alert('test');" />
</Buttons>
....


So I tried to copy the function in the JavaScript part but this gives errors 
in the xml.


Anyone an idea of whats getting wrong?













0
vanbocpe (21)
7/10/2008 1:52:01 PM
crm 35858 articles. 1 followers. Follow

2 Replies
496 Views

Similar Articles

[PageSpeed] 10

It is because of unsupported customizations. Your changes to the global.js 
file were overridden - actually the old global.js was removed and a new one 
was installed. The easiest solution is adding your function to the form 
OnLoad script, but it has to be a global function like this:

submitTS = function() {
//the code
}

More on this on http://www.stunnware.com/crm2/topic.aspx?id=JS5


-- 
Michael H�hne, Microsoft Dynamics CRM MVP

CRM Blog: http://www.stunnware.com/?area=blog

----------------------------------------------------------

"vanbocpe" <vanbocpe@discussions.microsoft.com> schrieb im Newsbeitrag 
news:7DB8C554-336D-4F89-81D3-5E0E68EBD2C8@microsoft.com...
> In CRM30 I had a button with some javascripting in behind.
>
> In the isvconfig file this was added within the right entity:
>
> ...
> <Buttons>
>            <Button Title="Submit TS" ToolTip="Submit TS"
> Icon="/_imgs/ico_16_2020.gif" JavaScript="submitTS();" />
> </Buttons>
> ...
>
> In the \_common\scripts\global.js this function was added:
>
> function submitTS()
> {
> var SubmitTSUrl;
> var selectedCount;
> var selectedState;
> SubmitTSUrl="http://192.168.14.10/TS/SubmitTS.aspx?";
> selectedCount=0;
> selectedState="";
> var _objRows = document.getElementById('gridBodyTable').rows;
>  for( var i = 0; i < _objRows.length; i++ )
>  {
> if(_objRows[i].className != 'grid')
> {
> SubmitTSUrl+="&oId=" + _objRows[i].oid;
> selectedCount++;
> selectedState=_objRows[i].cells[4].innerText;
> }
> }
> if (selectedCount!=1)
> {
> alert('Please select only one TS at a time from the list');
> }
> else
> {
> if (selectedState=="Submitted" || selectedState=="Approved")
> {
> alert('This TS cannot be submitted again.');
> }
> else
> {
> window.open(SubmitTSUrl, null, 'height=350px, width=440px, resizable=yes,
> status=yes, toolbar=no, center=yes, scrollbar=no');
> }
> }
> }
>
>
> Remind that this worked in CRM 30.
>
>
>
> So I upgraded the CRM30 to CRM40.
>
> When I click on the button I get a javascript error.
>
> I wanted to check the javascript in the global.js file, but, i only found 
> a
> global.js in the following directory :
> \_static\_common\scripts\        WITHOUT my javascript.
>
>
> Is this because of the upgrade? (unsupported coding?)
>
> Or is there an other way to add javascripting?
> When I do this in Crm40, it gives an alert.
> ...
> <Buttons>
>            <Button Title="Submit TS" ToolTip="Submit TS"
> Icon="/_imgs/ico_16_2020.gif" JavaScript="alert('test');" />
> </Buttons>
> ...
>
>
> So I tried to copy the function in the JavaScript part but this gives 
> errors
> in the xml.
>
>
> Anyone an idea of whats getting wrong?
>
>
>
>
>
>
>
>
>
>
>
>
> 


0
7/10/2008 8:18:33 PM
Are you sure that this is the way to  do this?

I tried that already and it keeps raising errors. The function can't be found.

I published the form, I enabled the onload script etc. 

Maybe I wasn't clear anought, this isn't a button in the form, but above the 
grid in the entity. When you click that button, does it steps into coding 
from the entity form ?







"Michael Höhne" wrote:

> It is because of unsupported customizations. Your changes to the global.js 
> file were overridden - actually the old global.js was removed and a new one 
> was installed. The easiest solution is adding your function to the form 
> OnLoad script, but it has to be a global function like this:
> 
> submitTS = function() {
> //the code
> }
> 
> More on this on http://www.stunnware.com/crm2/topic.aspx?id=JS5
> 
> 
> -- 
> Michael Höhne, Microsoft Dynamics CRM MVP
> 
> CRM Blog: http://www.stunnware.com/?area=blog
> 
> ----------------------------------------------------------
> 
> "vanbocpe" <vanbocpe@discussions.microsoft.com> schrieb im Newsbeitrag 
> news:7DB8C554-336D-4F89-81D3-5E0E68EBD2C8@microsoft.com...
> > In CRM30 I had a button with some javascripting in behind.
> >
> > In the isvconfig file this was added within the right entity:
> >
> > ...
> > <Buttons>
> >            <Button Title="Submit TS" ToolTip="Submit TS"
> > Icon="/_imgs/ico_16_2020.gif" JavaScript="submitTS();" />
> > </Buttons>
> > ...
> >
> > In the \_common\scripts\global.js this function was added:
> >
> > function submitTS()
> > {
> > var SubmitTSUrl;
> > var selectedCount;
> > var selectedState;
> > SubmitTSUrl="http://192.168.14.10/TS/SubmitTS.aspx?";
> > selectedCount=0;
> > selectedState="";
> > var _objRows = document.getElementById('gridBodyTable').rows;
> >  for( var i = 0; i < _objRows.length; i++ )
> >  {
> > if(_objRows[i].className != 'grid')
> > {
> > SubmitTSUrl+="&oId=" + _objRows[i].oid;
> > selectedCount++;
> > selectedState=_objRows[i].cells[4].innerText;
> > }
> > }
> > if (selectedCount!=1)
> > {
> > alert('Please select only one TS at a time from the list');
> > }
> > else
> > {
> > if (selectedState=="Submitted" || selectedState=="Approved")
> > {
> > alert('This TS cannot be submitted again.');
> > }
> > else
> > {
> > window.open(SubmitTSUrl, null, 'height=350px, width=440px, resizable=yes,
> > status=yes, toolbar=no, center=yes, scrollbar=no');
> > }
> > }
> > }
> >
> >
> > Remind that this worked in CRM 30.
> >
> >
> >
> > So I upgraded the CRM30 to CRM40.
> >
> > When I click on the button I get a javascript error.
> >
> > I wanted to check the javascript in the global.js file, but, i only found 
> > a
> > global.js in the following directory :
> > \_static\_common\scripts\        WITHOUT my javascript.
> >
> >
> > Is this because of the upgrade? (unsupported coding?)
> >
> > Or is there an other way to add javascripting?
> > When I do this in Crm40, it gives an alert.
> > ...
> > <Buttons>
> >            <Button Title="Submit TS" ToolTip="Submit TS"
> > Icon="/_imgs/ico_16_2020.gif" JavaScript="alert('test');" />
> > </Buttons>
> > ...
> >
> >
> > So I tried to copy the function in the JavaScript part but this gives 
> > errors
> > in the xml.
> >
> >
> > Anyone an idea of whats getting wrong?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 
> 
> 
> 
0
vanbocpe (21)
7/16/2008 2:31:12 PM
Reply:

Similar Artilces:

Creating PivotTable in Excel2007
How do you create a Pivot Table in Compatibility Mode in Excel 2007. The PivotTable need to be refreshed in Excel 2003. ...

SBS Exchange 2003: Create new user in AD but no exchange mailbox #3
I'm using SBS 2003. Exchange server is SP2. When I create a new user using Active Directory, it prompts me about creating a mail box. It says it's creating a mailbox, then it's done. But no mailbox appears. In fact, if I use the Exchange tasks wizard, I can create, delete, and recreate the mailbox--all say successful without an error message. And yet, no mailbox. This is even after I reboot the PC and sent email to the address. Any ideas what's going on? mike.aes@gmail.com wrote: > I'm using SBS 2003. Exchange server is SP2. > > When I create a new user ...

How do you replace old data with new data without creating a new .
I have existing pivot tables and I want to replace the data source worksheet with new data and the pivot tables update with the new information. I have replace the data source but the pivot tables didn't update. Hit the "Refresh Data" in the pivot table toolbar (looks like an exclamation point) -- Regards, Dave "Dena" wrote: > I have existing pivot tables and I want to replace the data source worksheet > with new data and the pivot tables update with the new information. I have > replace the data source but the pivot tables didn't update. So...

Resizing Option Button?
Hello Friends, I have asked a Question in mrexcel.com. But, the reply was it is not possible. Please check the below link and tell me is doable. http://www.mrexcel.com/board2/viewt...7747&highlight= Thanks, Nawaf -- countryfan_nt ------------------------------------------------------------------------ countryfan_nt's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=11051 View this thread: http://www.excelforum.com/showthread.php?threadid=482535 No you can't, at least not the actual button part. -- HTH RP (remove nothere from the email address if ...

Could Microsoft create a MSPOS user manual?
My customers are asking for one. Guess we were spoiled by RMS Store Operations having one available after Microsoft updated the SMS Commerce manuals. Makes me expect one for MSPOS even though most software no longer has printed manuals. -- Jeff Faul Merchants Solutions ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and t...

Viewing xml created in .Net in a ASP form VB6
I have been trying to create an xml document in VB.Net for displaying on an existing page written in ASP. im having a type mismatch error in my code. When i view my XML i have the following included in the <binary> node. <Binary xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">DATA HERE </Binary My issue is how do i set the datatype of the the node using dotnet so that i can replicate the same node structure and use my existing ASP page. thanks in advance Colin Graham ...

see chart from pushing button
how would I see a chart from pushing a button on the spreedsheet ? ...

Creating a form or template
We scanned in an image of a post it note that has graphics on it. It is a jpg file. Can we somehow make this jpg file a form or template in Outlook? Ideally, we want to pull up a form that looks like the image of a post it note with the graphics in tact and be able to compose a message on the email post it note. How do you accomplish this? Thanks! ...

Button Control Event: question
I have a small dialog that prints data it queries from a server to a listbox when a user presses a start button. What I'd like to do is to have the data continually print after the button is pressed until the user presses a stop button. So, I guess I would need to initiate some kind of continuous loop for the data querying/printing, but I'm unsure how to get the stop button to break the loop. If this even the best solution. Does anyone have any ideas of how I could accomplish this, or perhaps a better design idea? Thanks, Marcus Marcus wrote: > I have a small dialog that prints d...

Insufficient Permissions to Create Tasks
Hi, Exchange 5.5, Windows 2000, Outlook 2000. I have a user who is trying to create tasks and he gets a message that says that he does not have permission to do this. He can edit tasks and delete tasks, but not create them. We've run the repair utility, reinstalled, thought that it had to do with the PALM software and removed that, and there has been no change. Any help would be much appreciated! Thanks! ...

Fonts do not print in colur used when document created.
When I create a document in either Word ot Publisher the text is not always printed in the colour selected. This problem seems particular to Red & Blue. can any one help please. Peeter Have you tried some maintenance on your printer? Are you saving as a PDF? This problem has been reported using Microsoft's save as add-in. -- Mary Sauer http://msauer.mvps.org/ "Peter Piper" <PeterPiper@discussions.microsoft.com> wrote in message news:76737C66-2B07-42DF-BFC5-828A14CE135F@microsoft.com... > When I create a document in either Word ot Publisher t...

Hover buttons not loading quickly & Java Security Warning
Hi, I am pulling my hair out over this one! I'll be most grateful for any help. Here is the beginning of my new site: http://www.johnblaustein.com/web3/ You will notice that when the splash page transitions to the home.html page, the link images do not load immediately. I used FP2003's hover buttons for the links. The reason I want to use images instead of text for the links is so that the size of the links won't change if the user adjusts those browser settings. Can someone tell me why the buttons are loading so slowly? I suspect it is because the browse...

Choosing FROM when creating an e-mail
I have several e-mail accounts. When creating a new e- mail message sometimes I like the option of choosing a different e-mail account the new e-mail is 'from' rather than the default account. This function is possible in Outlook Express via a drop down list in the 'FROM' field when creating an e-mail, but Outlook doesn't even have a 'FROM' field and uses the default e-mail address as the return address. Please advise if this is possible in Outlook. Thanks. (PS I'm using Outlook 2000) Outlook 2000 Corporate or Workgroup mode (check Help->About) doe...

Creat new dictionery
It says when I try to add a new word to my dictionery that it is full. How do I expand same, or create a new dictionery? I use WORD 2003 See http://sbarnhill.mvps.org/WordFAQs/MasterSpellCheck.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "kernaghanl" <kernaghanl@discussions.microsoft.com> wrote in message news:BBC3C828-16EF-4861-B3A5-2A7CC406F43C@microsoft.com... > It says when I try to add a new word to my dictionery that it is full. > How > do I expand same, or create a new dictione...

Creating Custom Dialog Boxex (Popup)
Hello, I am trying to create a custom dialog box that will allow me to have the user clarify an entry when a checkbox is checked. I want them to be able to select something from a list that I have created. I have created the popup in Excel but cannot find out how to call the popup into the display when the checkbox is checked. Can anyone help me please? Is this a checkbox on the worksheet? If yes, then if it's a checkbox from the Forms toolbar, assign this macro to the checkbox: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Appli...

create tent fold card
I have a lot of cards made in pub03 that I can't print correctly in pub07. 07 wants to print 1 pic in the middle of the page and page 2 on a separate page. any way to print as a tent card the way pub 3 did? What size are you trying to print? A whole page folded or two cards per page? The page setup in 2007 takes a lot of getting use to. Open your document, file, page setup, click greeting card, select top fold, on the right click the advanced button. Do your adjusting. How did you setup your card in 2003? Did you insert two more pages? Page 4 would be the inside of your tent car...

How to create this grouping in ssrs?
I have a dataset with the following columns: This is a one to many relationship between the health authority to city and one to many relationship between the city and hospital column_group: health authority, city and hospital (three possible groupings for each of the row in the dataset) column_health_authority_name: it displays the name of the health authority to the row with the group "health authority" and it displays null to the "city" and "hospital" group column_city_name: it displays the city name to the row with the group "city" a...

Need to create blank computation column
Ok, let's try again. This time I'm breaking it down to a simple problem so that I don't confuse anyone: I have 3 cells in a row. In cell x I have a variable. In cell y I have a variable. In cell z I have a formula: =x*y . Now if the user is presented with variable x and nothing for variable y, and the formula is already in place, cell z will display 0. But I want the user to be presented with a blank field instead, until such time he/she enters in a variable for cell y. Therefore, I need to know what command will tell cell z to display a figure only if the computation is ...

create a button when pressed it will +1 to another field
Customer Survey- When a button or cell is pressed once it will add 1 to another existing field and every time it is pressed it will add another 1. Private Sub Commandbutton1_Click() Dim myRange as Range Dim myNumber as Long Set myRange =3D ActiveSheet.Range("a5") '<=3D=3D change myNumber =3D myRange.Value myNumber =3D myNumber + 1 myRange.Value =3D myNumber End Sub susan On Nov 24, 9:25=A0am, mswisher <mswis...@discussions.microsoft.com> wrote: > Customer Survey- When a button or cell is pressed once it will...

Create or find "Favorite Folders" pane
I can't find the "Favorite Folders" pane above "Folders List", anymore. If you're using the Folder List then the Favorite Folders section won't appear. "ChristiA" <ChristiA@discussions.microsoft.com> wrote in message news:CEC82608-6F53-4269-9799-61D3DF7374E1@microsoft.com... >I can't find the "Favorite Folders" pane above "Folders List", anymore. ...

How to create splitter in a CWnd derived class?
Hi, I 've some peculiar problem. I need to create a splitter with two separate views and all inside a CWnd derived class. So I 've to provide splitter control inside a CWnd class and not inside regular CFrameWnd derived classes. Does any body knows how to solve this? Please help me out. Thanks in advance. Snehasish Paul (India) snehasish@gmail.com wrote: > Hi, > > I 've some peculiar problem. > I need to create a splitter with two separate views and all inside a > CWnd derived class. > So I 've to provide splitter control inside a CWnd class and not insi...

Run script from Entity Toolbar Custom Button
I have added a button to the Opportunity Entity toolbar and what I'd like to do is get it to run the change event script on one of the fields on the Opportunity form. I can't seem to get this to work using: JavaScript="crmForm.all.fieldname.FireOnChange();" Presumably this is because crmForm isn't the Opportunity form. Is there any other way I can do this? -- CB ...

create 2 user in 1 outlook
1. how can i create or add a user in the same outlook mail? 2. how can i create the folder in inbox for the different user in the same mic outlook? 3. can i use the same mic outlook for my mail, means that i just share the mic. off. your regards, k3chikz What version and mode of Outlook are you using? You will need to create either Outlook Profiles or Windows Profiles depending on the answer. Post this information and someone can help you out. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Having searched the arc...

all the standard buttons have gone from Outlook Express
I have no idea how this has happened, but all the standard buttons have gone from Outlook Express 5 when creating, sending or reading messages in the Inbox. I tried the View>Toolbars>Standard Buttons/Customise, nothing happened. The inteface won't appear, the buttons won't come back. OE is my default email reader. All this means I can only use the keyboard shortcuts to send, reply to emails. It wasn't like this last night. Any ideas? Tim Did you try right-mouse clicking in a blank area of one of the existing tool bars and then click on the "tool bar&qu...

Can't create contact from Account
When I try to create a contact from an account (clicking on contact view in left pane when viewing an account profile). It populates the new contact profile with the address, phone #, etc. from the account which is great. But when I enter the first and last name of the contact and save, I get an error "duplicate record - A record with these values already exists. A duplicate record cannot be created. Select one or more unique values and try again." Any ideas? Hi, Do you knwo if you have the c360 addon or custom code to check for duplicates in your system? It telling y...