Monday, July 19, 2010

Hide field in client side

Hi,
Here is fnunction to hide field in client Side, Javascript:

function HideField(fieldName, visible) {
var label = document.getElementById(fieldName + '_c');
var value = document.getElementById(fieldName + '_d');
if (label)
label.style.display = visible ? 'inline' : 'none';
if (value)
value.style.display = visible ? 'inline' : 'none';
}


thanks,
Rami Heleg

Sunday, July 18, 2010

How to find which Rollup CRM installed?

I installed some rollups.

i want to know if i installed specific version

1. open control panel/ installed updated and check which version like next picture



2. if you see only KBXXX go to crm download rollup center and check the rollup id like this pictures



thanks,
Rami Heleg.

Monday, July 12, 2010

Using RemoteCommand in CRM 4.0

What is it RemoteCommand ?
RemoteCommand is Microsoft XmlHttp interface.

Microsoft blocked the option to use RemoteCommand in CRM 4.0
How to use RemoteCommand in CRM 4.0?
1. Copies file RemoteCommand.JS from CRMWEB\_static\_controls\RemoteCommands to user local folder with JS and rename the file for instance customRemote.js
2. Rename function: RemoteCommand to CustomCommand and add another parameters for instance:
function CustomCommand (sObject, sCommand, sUrlBase, sNamespace)
3. Change the row:
var sCommandNamespace =_sWebServicesNamespace; to
var sCommandNamespace = sNamespace ? sNamespace : _sWebServicesNamespace;

finish to change the file.

Call to function from Javascript:

var cmd = new CustomCommand('webServiceName', 'functionName', '/MySite/', 'http://NameSpace');
cmd.SetParameter('incidentID', objectid);
cmd.SetParameter('targetID', instanceID);
var rslt = cmd.Execute();
if (!rslt || !rslt.ReturnValue){
//work good
return;

}
if (rslt.ReturnValue.errorDescription) {
//Failed
alert(rslt.ReturnValue.errorDescription);
return;
}

Define name space in c# code:

[WebService(Namespace="http://NameSpace")]
public class webServiceName: System.Web.Services.WebService {


thanks,
Rami Heleg,

Set in client Side values into disabled field

To set value into disabled field must set values like that:

crmForm.all.new_myfield.ForceSubmit = true;
crmForm.all.new_myfield.defaultValue = crmForm.all.new_myfield.DataValue = value;

by default crm doesn't send disbaled values from client to server in save entity.

thanks,
Rami Heleg

Audit - who opened CRM pages

I want to write in audit log who opened crm pages ( view contact, account etc...) what should i do?



with PlugIn registration register to message retrieve for the relevant evtities.



retrieve event appear only if open the edit.aspx page with record.
open edit.aspx in new form, crmForm.FormType = 1 will not exevute the event.



thanks,
Rami Heleg

Monday, July 5, 2010

Create CrmService with Caller Id

Here is the example to create CrmService:

CrmAuthenticationToken token = new CrmAuthenticationToken();
token.OrganizationName = "org1";
token.AuthenticationType = 0; //Active directory
token.CallerId = userGuid; // impersonate to this user
CrmService pService = new CrmService();
pService.Url = _strServerUrl + "/MSCRMServices/2007/crmservice.asmx";
pService.CrmAuthenticationTokenValue = token;
pService.Credentials = DefaultCredential();

i can create crmService from two type

1. CrmService as web service from mscrmservices\2007
2. Microsoft.Crm.SDK.

to change the callerid i failed to do it if i used Crmservice from webservice.

i test the issue and changing the caller works only if Crmservice from type Microsoft.Crm.Sdk.

thanks,
Rami Heleg,
NetusUp Inc.