UPDATE MSCRM_CONFIG..ServerSettingsProperties SET BitColumn = 1 WHERE ColumnName = 'AllowDeclarativeWorkflows'
Monthly Archives: January 2012
Debug latest JavaScript in browser
IE:
Internet Options –> Advanced –> Browsing –> “Disable script debugging (Internet Explorer)” = OFF
Internet Options –> Advanced –> Browsing –> “Disable script debugging (Other)” = OFF
Internet Options –> Advanced –> Browsing –> “Show friendly HTTP error messages” = OFF
Internet Options –> General–> Browsing history –> Settings –> Check for newer versions of stored pages: == “Every time I visit the webpage”
Clear cache
Internet Options –> General–> Browsing history –> Delete… –>
Uncheck “Preserve Favorites website data”
Check “Temporary Internet files” “Cookies”
–> Delete
Dynamics CRM:
Set the DevErrors attribute to On in the Web.config file.
Firefox:
visit about:config, find the browser.cache.check_doc_frequency and change it to 1.
0 – Check for a new version of a page once per session (a session starts when the first application window opens and ends when the last application window closes).
1 – Check for a new version every time a page is loaded.
2 – Never check for a new version – always load the page from cache.
3- Check for a new version when the page is out of date. (Default)
http://www.imasuper.com/53/technology/firefox-caching-get-latest-page-every-time
How to use Magento WS-I compliant v2 API
$proxy = new SoapClient('http://127.0.0.1/Magento1620/index.php/api/v2_soap?wsdl', array('trace' => 1, 'connection_timeout' => 120));
$session = $proxy->login(array(
'username' => "xxyyzz",
'apiKey' => "xxyyzz"
));
$sessionId = $session->result;
$filters = array(
'complex_filter' => array(
array(
'key' => 'product_id',
'value' => array(
'key' => 'eq',
'value' => '18'
)
)
)
);
$products = $proxy->catalogProductList(array("sessionId" => $sessionId, "filters" => $filters));
magento web service filter product list error Call to a member function getBackend() on a non-object
Using visual studio 2010 service reference to consume magento soap v2 api web service.
php 5.3.8, magento 1.6 install on windows 7 iis 7.5
I can log in and list all the product, but as soon as i put a filter there is an exception
Call to a member function getBackend() on a non-object
php error log:
PHP Fatal error: Call to a member function getBackend() on a non-object in C:\inetpub\wwwroot\Magento1620\app\code\core\Mage\Eav\Model\Entity\Abstract.php on line 816
the solution is to modify this file, change line 57-62
\app\code\core\Mage\Catalog\Model\Product\Api\V2.php
from
foreach ($filters->complex_filter as $_filter) {
$_value = $_filter->value;
$preparedFilters[$_filter->key] = array(
$_value->key => $_value->value
);
}
to
foreach ($filters->complex_filter as $_field => $_filter) {
$preparedFilters[$_field] = array(
$_filter->key => $_filter->value
);
}
error consume magento soap v2 api by using visual studio web reference unexpected end of file has occurred
find file
\app\code\core\Mage\Api\Model\Server\Wsi\Adapter\Soap.php
search for “\n” and replace with empty string (just delete it)
Check sql statement executed in mysql
mysql> SHOW VARIABLES LIKE “general_log%”;
+——————+—————————-+
| Variable_name | Value |
+——————+—————————-+
| general_log | OFF |
| general_log_file | /var/run/mysqld/mysqld.log |
+——————+—————————-+
mysql> SET GLOBAL general_log = ‘ON’;
mysql> SET GLOBAL general_log = ‘OFF’;
http://stackoverflow.com/questions/568564/how-can-i-view-live-mysql-queries
SkyDrive as mapped network drive
WCF service client (Service References) to call Dynamics CRM 4 web service
1. change system.serviceModel configuration
2. Call web service
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="CrmServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="163840" /> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://dcbr03vrms01/MSCrmServices/2007/CrmService.asmx" binding="basicHttpBinding" bindingConfiguration="CrmServiceSoap" behaviorConfiguration="CrmBehavior" contract="CrmSdk.CrmServiceSoap" name="CrmServiceSoap" /> </client> <extensions> <behaviorExtensions> <add name="CrmRemoveHeaderBehavior" type="ConsoleApplication2.CrmBehaviorExtensionElement, ConsoleApplication2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> </behaviorExtensions> </extensions> <behaviors> <endpointBehaviors> <behavior name="CrmBehavior"> <CrmRemoveHeaderBehavior /> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel>
using System;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//WcfCall();
AsmxCall();
}
static void WcfCall()
{
/*
* <extensions>
* <behaviorExtensions>
* <add name="CrmRemoveHeaderBehavior" type="
*/
var extensions_behaviorExtensions_add_type = typeof(CrmEndpointBehavior).AssemblyQualifiedName;
CrmSdk.CrmServiceSoapClient service = new ConsoleApplication2.CrmSdk.CrmServiceSoapClient();
//service.Endpoint.Behaviors.Add(new CrmEndpointBehavior());
service.ClientCredentials.Windows.ClientCredential.Domain = "comcare.gov.au";
service.ClientCredentials.Windows.ClientCredential.UserName = "zhou.zhongchen";
service.ClientCredentials.Windows.ClientCredential.Password = "p@ssw0rd1";
CrmSdk.CrmAuthenticationToken token = new ConsoleApplication2.CrmSdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "RMSDev";
var aaa = service.Retrieve(token, null, null, CrmSdk.EntityName.contact.ToString(), new Guid("EF255982-CE4E-E011-A714-0050568B129A"), new CrmSdk.ColumnSet() { Attributes = new string[] { "address1_telephone3" } });
}
static void AsmxCall()
{
Sdk.CrmService service = new ConsoleApplication2.Sdk.CrmService();
Sdk.CrmAuthenticationToken token = new ConsoleApplication2.Sdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "RMSDev";
service.CrmAuthenticationTokenValue = token;
service.CallerOriginTokenValue = new ConsoleApplication2.Sdk.CallerOriginToken() { CallerOrigin = new Sdk.WebServiceApiOrigin() };
service.CorrelationTokenValue = null;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
var aaa = service.Retrieve(CrmSdk.EntityName.contact.ToString(), new Guid("EF255982-CE4E-E011-A714-0050568B129A"), new Sdk.ColumnSet() { Attributes = new string[] { "address1_telephone3" } });
}
}
public class CrmMessageInspector : IClientMessageInspector
{
#region IClientMessageInspector Members
public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
{
}
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
request.Headers.RemoveAll("CallerOriginToken", "http://schemas.microsoft.com/crm/2007/WebServices");
request.Headers.RemoveAll("CorrelationToken", "http://schemas.microsoft.com/crm/2007/WebServices");
return null;
}
#endregion
}
public class CrmEndpointBehavior : IEndpointBehavior
{
#region IEndpointBehavior Members
public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new CrmMessageInspector());
}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
}
public void Validate(ServiceEndpoint endpoint)
{
}
#endregion
}
public class CrmBehaviorExtensionElement : BehaviorExtensionElement
{
public override Type BehaviorType
{
get
{
return typeof(CrmEndpointBehavior);
}
}
protected override object CreateBehavior()
{
return new CrmEndpointBehavior();
}
}
}
c# convert int number to human readable word text date
public static class DateUtility
{
private static string[] _unitsMap = new[]
{
"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"
};
private static string[] _tensMap = new[]
{
"Zero", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"
};
private static string[] _days = new string[]
{
"First", "Second", "Thrid", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth",
"Eleventh", "Twelfth", "Thirteenth", "Fourteenth", "Fifteenth", "Sixtenth", "Seventeenth",
"Eighteenth", "Nineteenth", "Twentieth", "Twenty-First", "Twenty-Second", "Twenty-Third",
"Twenty-Fourth", "Twenty-Fifth", "Twenty-Sixth", "Twenty-Seventh", "Twenty-Eighth",
"Twenty-Ninth", "Thirtieth", "Thirty-First"
};
private static string[] _month = new string[]
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
private static string[] _shortMonth = new string[]
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
private static string NumberToWords(int number)
{
if (number == 0)
return "Zero";
if (number < 0) return "Minus " + NumberToWords(Math.Abs(number)); string words = ""; if ((number / 1000000) > 0)
{
words += NumberToWords(number / 1000000) + " Million ";
number %= 1000000;
}
if ((number / 1000) > 0)
{
words += NumberToWords(number / 1000) + " Thousand ";
number %= 1000;
}
if ((number / 100) > 0)
{
words += NumberToWords(number / 100) + " Hundred ";
number %= 100;
}
if (number > 0)
{
if (words != "")
words += "and ";
if (number < 20) words += _unitsMap[number];
else
{
words += _tensMap[number / 10]; if ((number % 10) > 0)
words += "-" + _unitsMap[number % 10];
}
}
return words;
}
public static string GetDayWord(int day)
{
day--;
if (day < 0 || day >= _days.Length)
return string.Empty;
return _days[day];
}
public static string GetMonthWord(int month)
{
month--;
if (month < 0 || month >= _month.Length)
return string.Empty;
return _month[month];
}
public static string GetShortMonthWord(int month)
{
month--;
if (month < 0 || month >= _shortMonth.Length)
return string.Empty;
return _shortMonth[month];
}
public static string GetYearWord(int year)
{
if (year < 0 || year > 9999)
{
return string.Empty;
}
else
{
return NumberToWords(year);
}
}
public static string GetWord(DateTime dateTime)
{
return GetWord(dateTime.Year, dateTime.Month, dateTime.Day);
}
public static string GetWord(int year, int month, int day)
{
string word = string.Empty;
string dayWord = GetDayWord(day);
string monthWord = GetMonthWord(month);
string yearWord = GetYearWord(year);
return string.Format(@"{0} of {1} {2}", dayWord, monthWord, yearWord);
}
}
Display dynamics crm 2011 right click context menu
document.oncontextmenu = null;
document.frames['contentIFrame'].document.oncontextmenu = null;