CRM 2011 Homepage Grid Ribbon enable rule doesn't work - dynamics-crm-2011

I have a custom button in Activity homepage grid ribbon. I have an enable rule that calls a Javascript function. This rule doesn't seem to be working - it's not calling the Javascript function, I've put an alert to verify this. When I test my javascript function by calling from a Form OnLoad, everything looks fine.
So i'm guessing that the Homepage ribbon is not loading the js library somehow ? Has anyone come across this before ?
Please help.
<EnableRule Id="RRM.activitypointer.HomepageGrid.RunReport">
<CustomRule Library="RRM_/Script/Common/Main.js" FuncionName="RRM.Common.enableRunReport"></CustomRule>
</EnableRule>

I've found the solution.
A couple of things
1. The way the webresource is called. Changing the rule to something like below worked
<CustomRule Library="$webresource:RRM_/Script/Common/Main.js" .. >
2. Loading the dependent webresources (since this button is not on a form). Adding dummy custom rules to call the dependent webresources fixed it
<CustomRule Library="$webresource:name" Functionname="isNAN"/>

You have a typo, is FunctionName instead of FuncionName

<EnableRule Id="RRM.activitypointer.HomepageGrid.RunReport">
<CustomRule Library="$webresource:name" Functionname="isNAN"/>
<CustomRule Library="RRM_/Script/Common/Main.js" Functionname="RRM.Common.enableRunReport"></CustomRule>
</EnableRule>

Related

Using SELECT Options outside of Fields in Angular-Formly

I have found Angular-formly and it looks awesome. However, I have found a problem. We load the array of options for our <SELECTS> using an Ajax call so the select options can come asynchronously.
Unless I am missing something (hopefully) it seems we need to have the array when we create the "fields" for the form.
I have set up an example here http://jsbin.com/tihofegifu/edit
Ideally I would like to load the Array for the SELECT OPTIONs via ajax and formly to use the options like standard Angular does.
Another issue is editing the array using angular as in the button will not work.
What am I missing or doing Wrong?
I think the example you're looking for is on the website. Basically, you create a controller for the field to do the loading for you. You could also define that controller as part of a custom type.
Alternatively, you could also use expressionProperties which can accept a promise and you could do:
expressionProperties: {
'templateOptions.options': function() { /* return promise that resolves to the options you want*/ }
}
Good luck! Enjoy angular-formly :-)

SharePoint SaveButton RedirectURL attribute doesn't do anything. Why?

I have a SharePoint SaveButton in my EditFormTemplate and I don't want the browser to redirect to the default location which is the List View (i.e. AllItems.aspx). I instead want the user to be redirected to another page.
Many other people seem to have the same issue. I do not wish to replace the SharePoint SaveButton with a standard aspx button control and use JavaScript as this presents it's own set of problems and frankly I don't think that this sort of functionality deserves a JavaScript hack.
If an attribute called "RedirectURL" does in fact exist for the SharePoint SaveButton (which it does) then why on Earth would it not simply redirect the browser to the specified URL?
<SharePoint:SaveButton ID="SaveButton1" runat="server" RedirectUrl="[My Custom URL]" />
Why doesn't the code above do what I want it to do?
You need to use a JavaScript call ddwrt:GenFireServerEvent('_redirect={URL}'.
Take a look at the example below:
<input type="button" class="contact-button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={example.aspx}')}" />
Hope this helps.
OK. I figured it out.
I created a SPListItemEventReceiver and set the ItemUpdated Synchronization element in the Elements.xml file to "Synchronous".
<Synchronization>Synchronous</Synchronization>
I then followed the instructions outlined here.
Since I needed to perform the redirect after an Update I didn't have to do all of the hacky stuff to try and perform an Updated async operation in the Updating async event as described in the link above for ItemAdded and ItemAdding.
I simply added a private HttpContext property called currentContext, added a default constructor where I set the currentContext property to HttpContext.Current and then did the SPUtility.Redirect in my ItemUpdated event using the value stored in the currentContext property that was set in the constructor.
I've had problems with the SaveButton if the URL of the form it is used on includes a Source parameter. I don't recall details but my fix was just not to include that parameter when opening the form.
Sounds like a different problem for you, but that may help someone.
Dave

using tabbedPanels in a formTable

has anyone got an example of using tabbedPanel in a formTable ?
my form has alot of fields, I'm new to Xpages so just looking for a best practice.
thanks
I have a working example of the opposite - a tabbedPanel, each with a formTable inside with validation, and it works well when there are a lot of fields. Keep in mind that if you use the SSJS validation, whenever you click any tab, the current tab's validation will be triggered.
You can try a dojo tabContainer, with formTables inside, too, where if you switch tabs, no validation will be triggered. You may get js errors, if you set the focus to a field which is in a different tab. I'm not using a dojo tabContainer, because this project is for IE7 and I find it's very slow for this browser.

Watir Webdriver fire_event onmouseover no longer working

I've been using Watir to automate testing of my companies primary web app. The tests require a javascript dropdown menu fired by mouse over, and a link on that menu to be clicked.
$browser.link(:id=> 'element').fire_event "onemouseover"
Was working perfectly until we changed the look and feel of the app. The changes made to the look in feel didn't appear to change in any way how the HTML looks and the menus work. Everything else is working fine with Watir.
I've tried using a solution that seemed to work for others, by including:
class Watir::Element
def hover
assert_exists
driver.action.move_to(#element).perform
end
end
and using
browser.div(:id => "someId").hover
But when the menus appear they instantly go away before the driver has a chance to click the menu item.
browser.div(:id => "someId").hover
sleep 3
Will solve the problem. I have faced same issue and sleep solved it :)
I've managed to get around this one (provided the site uses jquery) by using execute_script to fire off some jquery to override the visibility on the 'hidden' menus. See this answer https://stackoverflow.com/a/8392467/409820 for more info
Needing to do that was one reason I and others requested the .hover method, so that is also something you could try.
(my scripts are still using that particular trick because a) it's working, and b) I'm working on other stuff right now and don't have a pressing need to fiddle with them.

SharePoint 2007 - add additional menu to Global Navigation in a Master Page

In the source code for a master page, there is a section that has the following ASP.NET item: . This contains the "Welcome (User Name)" and Site Actions menus.
How do I create an additional menu that is similar to the look and feel of the Welcome menu? I've tried to create Front End HTML that behaves similar to the out of the box SharePoint menus, but it isn't quite right. I would prefer to utilize an ASP.NET or SharePoint control that acts similar to the SharePoint menu if that is possible.
For example, is <SharePoint:AspMenu> the appropriate control to use?
Thanks,
Robert
i am sure you will get better answer than this but just wanted to point what i have done to do this
i have added javascript library (JQuery) (for some other reason ) and when time come to do this thing i just added a JQuery code that creates another item in the navigation list with appropriate style and css class with the needed link and caption.
You could try another instance of the PersonalActions control with a custom GroupId. But when the control is rendered, it might also say "Welcome, [User]" just like the original.

Resources