CRM 2011 - addCustomView on Google Chrome - dynamics-crm-2011

I have been on a CRM 2011 project that uses a lot of custom views.
I recently figured it out that all lookup custom views are only working properly in the internet explorer. When I try using google chrome (Version 51.0.2704.84 m) it simple does not work.
I googled without luck.
Is anyone aware about how to solve that issue?
I'm sure many of you have faced the same problem.
Here is my code. I emphasize that it works like a charm in IE.
var viewId = "{1DFB2B35-B07C-44D1-868D-258DEEAB88E1}";
var entityName = "tz_tipodefrete";
var viewDisplayName = "Tipos de Frete Disponíveis";
var fetchXml =
"<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>" +
"<entity name='tz_tipodefrete'>" +
"<attribute name='tz_name'/>" +
"<order descending='false' attribute='tz_ordem'/>" +
"<filter type='and'>";
if (filtrar)
fetchXml = fetchXml + "<condition attribute='tz_name' value='Cliente Retira e instala no CT' operator='ne'/>";
fetchXml = fetchXml +
"<condition attribute='statecode' value='0' operator='eq'/>" +
"</filter>" +
"</entity>" +
"</fetch>";
// build Grid Layout
var layoutXml = "<grid name='resultset' object='1' jump='tz_name' select='1' icon='1' preview='1'>" +
"<row name='result' id='tz_tipodefreteid'>" +
"<cell name='tz_name' width='600' />" +
"</row>" +
"</grid>";
Xrm.Page.getControl("tz_tipodefrete").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
//Desabilita a opção do usuário trocar de view. Provável que pare de funcionar na migração para versão 2015
document.getElementById("tz_tipodefrete").setAttribute("disableViewPicker", "1");

Have you tried taking the brackets off the guid?
Ex. var viewId = "1DFB2B35-B07C-44D1-868D-258DEEAB88E1";
In some situations, that helps.

Related

Trick to expand Xamarin Form WebView as per dynamic content

I have a WebView in my project. It can have dynamic html content. For now i have given fixed width and height to WebView and it scrolls. But i want to remove scroll by increasing height of WebView dynamically.
Is there any way like by creating custom renderer or something?
Sample code
var webvw = new Webview();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = #"<html>" +
"<head>" +
"<style type=\"text/css\">" +
"#font-face {" +
"font-family: Roboto-Medium;" + fntsrc + "}" +
"html,body{margin:0px;}" +
"body {" +
"font-family: Roboto-Medium;" +
"font-size: 12px" +
"text-align: left;" +
"color: #acacac;" + "}" +
"body :first-child{" +
"font-family: Roboto-Medium;" +
"font-size: 12px" +
"font-weight: 300;" +
"line-height: 24px;" +
"text-align: left;" +
"color: #ffffff;" + "}" +
"</style>" +
"</head>" +
"<body style=\"background-color: transparent;\" >" +
dynamicContent + "</body>" + "</html>";
webvw.Source = htmlSource;
webvw.WidthRequest = 500;
webvw.HeightRequest = 500;
SatackLayout webContnet=new StackLayout{
VerticalOptions=LayoutOption.FillAndExpand,
Orientation=StackOrientation.Vertical
};
There is a way but it is complicated. The WebView won't automatically size to its content, so the only way you could do it is if the content notifies your code how big it is.
To do this you will need to Invoke C# from Javascript.
Its a mildly complex procedure and you will need a CustomRenderer and also setup properties in each of the native projects. Follow the link above for a step by step guide on how to do it.
The Javascript you invoke something like this to get the height
var body = document.body,
html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
Then when its returned back, set your WebView to that height. You may also need to wait until the NavigationCompleted Event is raised before doing this to ensure the contents have loaded in your WebView.
ok here is my "if it looks stupid but works it ain't stupid"-answer.
i run into the same problem and searched for a way to get the possible height.
my solutions is now to create a lable with costum renderes to convert the html code. the label has a property for height and width ;)
so i create the label, put it in a StackLayout(it needs to be rendered), get the size to the WebView, remove the label from the StackLayout and add now the WebView with a perfect size :)
webView = new WebView();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = htmlCode;
webView.Source = htmlSource;
tmpLable = new HyperLinkLabel {
Text = htmlCode,
};
stackLayout.Children.Add(tmpLable);
webView.WidthRequest = tmpLable.Width;
webView.HeightRequest = tmpLable.Height;
stackLayout.Children.Remove(text);
stackLayout.Children.Add(web);

SharePoint 2013 Custom button to Delete a Page

I want to delete the the Page with custom button. I have searched the the whole but found nothing. I have tried to find the ID of Delete button from Ribbon. But this also does not work.
I found a link but it does not help me.
[1] :https://sharepoint.stackexchange.com/questions/19887/custom-delete-page-button
Anyone here know about the solution.
I am surprised that no one have answer the question. Then I go deeper in Sharepoint and find a Solution to delete the page with custom Button or link.
So i decided to share with you guys. May be someone in future need this. I have achieve this through Javascript.
function deletePage() {
var url = document.location.pathname;
var urls = url.split("/");
var newurl = urls[1].concat("/", urls[2], "/", urls[3], "/Pages/Forms/AllItems.aspx");
var context = SP.ClientContext.get_current();
var web = context.get_web();
var folder = web.getFolderByServerRelativeUrl(url);
var confirmDelete = confirm("Do you want to delete this news ??");
if (confirmDelete) {
folder.deleteObject();
}
//if (confirmDelete) {
// window.location = "/" + newurl;
//}
context.executeQueryAsync(
function () {
if (confirmDelete) {
window.location = "/" + newurl;
}
}
);
}
And Just call this function onclick.
<li><i class="fa fa-close"></i>Delete</li>
Well this is working perfect.
Thanks

Responsive rotating banner on SharePoint 2013

is there any tool or webPart to add banners to sharepoint 2013 that support responsiveness?
You don't need anything SP specific. I've used flexslider in the past for SP and otherwise. Just use REST to populate from your list and call flexslider in the ajax success callback.
(Too long for a comment) I do on my other machine - this is a 2010 example where I used SPServices to do the same thing. Same concept - generate your markup with the response data and apply flexslider after the markup is populated.
$(document).ready(function() {
$().SPServices({
operation: "GetListItems",
async: false,
webURL: "/",
listName: "Home Slider",
CAMLViewFields: "<ViewFields><FieldRef Name='ImageLink' /><FieldRef Name='Title' /><FieldRef Name='SubTitle' />"
+ "<FieldRef Name='LinkText' /><FieldRef Name='LinkURL' /><FieldRef Name='Description' />"
+ "</ViewFields>",
completefunc: function (xData, Status) {
var myslider;
var liHtml = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
liHtml += "<li style='background:url(" + $(this).attr("ows_ImageLink") + ") no-repeat center top;'>"
+ "<div class='slideWrap'><div class='slideInnerWrap'>"
+ "<h2>" + $(this).attr("ows_Title") + "</h2>"
+ "<a href='" + $(this).attr("ows_LinkURL") + "' class='btn btnOrange btnLarge' >"
+ $(this).attr("ows_LinkText") + "</a>"
+ "</div></div>"
+ "</li>";
});
$("#sliders").append("<ul class='slides'>" + liHtml + "</ul>");
$('.flexslider').flexslider({
directionNav: true,
animation: "slide"
});
}
});
});

Web page "timestamp"

Is there a web site that can verify your web pages. Specifically, let's say you created a web page on Monday and you want your users to be assured that when they view the same page on Tuesday, that it's the same page that was posted on Mondya (without any modifications).
Thank you.
To get the last modified data of a webpage, you can use the document.lastModified property with javascript.
In order to ensure your users, see:
How to display the last modified date
You can verify your own web pages with a little bit of javascript
<script type="text/javascript" language="JavaScript" src="lastupdated.js"></script>
<script type="text/javascript" language="JavaScript">
<!-- Write last modified date at the bottom of the page
var dateObj = new Date(document.lastModified)
var dateString = lastUpdated(dateObj)
document.write(dateString)
// -->
</script>
And this is the lastupdated JavaScript
function lastUpdated(dateObj)
{
var dayNames = new Array(8);
dayNames[1] = "Sunday";
dayNames[2] = "Monday";
dayNames[3] = "Tuesday";
dayNames[4] = "Wednesday";
dayNames[5] = "Thursday";
dayNames[6] = "Friday";
dayNames[7] = "Saturday";
var monthNames = new Array(13);
monthNames[1] = "January";
monthNames[2] = "February";
monthNames[3] = "March";
monthNames[4] = "April";
monthNames[5] = "May";
monthNames[6] = "June";
monthNames[7] = "July";
monthNames[8] = "August";
monthNames[9] = "September";
monthNames[10] = "October";
monthNames[11] = "November";
monthNames[12] = "December";
var theDay = dayNames[dateObj.getDay() + 1];
var theMonth = monthNames[dateObj.getMonth() + 1];
var dayNumber = dateObj.getDate();
var fullYear = dateObj.getYear();
if (fullYear < 1900) { fullYear = fullYear + 1900 };
var dateString = '<center><font face="arial, helvetica" size="-3">' + "Last modified on " + theDay + ", " + theMonth + " " + dayNumber + ", " + fullYear + " </font></center>";
return dateString;
}

Deploy aspx page in /Lists folder programmatically

I have a need to deploy ASP.NET application page from assembly to /Lists/ (http://server/Lists) folder.
How can I get "physical" page object
from page that is made in assembly?
Project tree http://img17.imageshack.us/img17/4242/ss20090922150130.png
How can I deploy this page as module
or by FeatureReceiver? "Physycally" folder Lists does not exist.
Thank you for assistance.
Edit: I want to do exactly what SharePoint Designer is doing by clicking this button:
SharePoint Designer http://img121.imageshack.us/img121/5163/ss20090923160323.png
I'm not sure exactly what you are after, but I'm guessing that you want to create a page and check it in to a list?
This code snippet does that for a publishing page in MOSS:
using (SPWeb web = siteCollection.RootWeb)
{
PublishingSite publishingSite = new PublishingSite(siteCollection);
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
// Article Page content type
SPContentTypeId articleContentTypeID = new SPContentTypeId("0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D");
PageLayout[] layouts = publishingWeb.GetAvailablePageLayouts(articleContentTypeID);
PageLayout articlePageLayout = layouts[0];
string pageName = "LegalInformation.aspx";
SPQuery query = new SPQuery();
query.Query = string.Format("" +
"<Where>" +
"<Eq>" +
"<FieldRef Name='FileLeafRef' />" +
"<Value Type='File'>{0}</Value>" +
"</Eq>" +
"</Where>" +
"", pageName);
// Does the file already exists ?
PublishingPageCollection pageColl = publishingWeb.GetPublishingPages(query);
if (pageColl.Count > 0)
{
return;
}
PublishingPage newPage = publishingWeb.GetPublishingPages().Add(pageName, articlePageLayout);
newPage.ListItem[FieldId.Title] = "This page title";
newPage.ListItem[FieldId.PublishingPageContent] = "<P style='MARGIN-TOP: 20px'>Your content here</P>"";
newPage.Update();
// Check in file
if (newPage.ListItem.File.CheckOutStatus != SPFile.SPCheckOutStatus.None)
{
newPage.ListItem.File.CheckIn(string.Empty);
}
// Publish file
newPage.ListItem.File.Publish(string.Empty);
}

Resources