Dans le Onload du formulaire, insérer le code suivant :
crmForm.all.hab_bouton_c.style.display = 'none' crmForm.all.hab_bouton_d.innerHTML = ""; ButtonClick = function() { alert('Hello!'); }
On obtient un bouton qui contient un événement onclick.
crmForm.all.hab_bouton_c.style.display = 'none' crmForm.all.hab_bouton_d.innerHTML = ""; ButtonClick = function() { alert('Hello!'); }
function DesactiveLookup(sNomAttribut){ crmForm.all[sNomAttribut].Disabled=true; var loSpan = document.getElementById(sNomAttribut + '_d').getElementsByTagName('SPAN'); for (var liSpan = 0; liSpan < loSpan.length; liSpan++){ loSpan[liSpan].onclick = function(){}; loSpan[liSpan].style.textDecoration ='none'; loSpan[liSpan].style.color = '#000000'; }}Pour l'utiliser, il suffit d'appeler la fonction avec en argument le nom de l'attribut Lookup.
DesactiveLookup('parentcustomerid');
private void prvLectureContacts() { var loCrm = new Xrm.XrmDataContext("CRM"); // Setup the Authentication Token CrmAuthenticationToken loToken = new CrmAuthenticationToken(); loToken.AuthenticationType = AuthenticationType.AD; loToken.OrganizationName = "entreprise"; CrmService loCrmService = new CrmService(); UriBuilder loBuilder = new UriBuilder("http://entreprise:5555/entreprise"); loBuilder.Path = "//MSCRMServices//2007//CrmService.asmx"; loCrmService.Url = loBuilder.Uri.ToString(); loCrmService.CrmAuthenticationTokenValue = loToken; loCrmService.Credentials = System.Net.CredentialCache.DefaultCredentials; loCrmService.CrmAuthenticationTokenValue = loToken; WhoAmIRequest loRequest = new WhoAmIRequest(); WhoAmIResponse loResponse = (WhoAmIResponse)loCrmService.Execute(loRequest); var loRequetContact = from c in loCrm.contacts where c.ownerid.Value == loResponse.UserId && c.fullname == txtRecherche.Text select c; cbResultat.Items.AddRange(loRequetContact.ToArray()); cbResultat.DisplayMember = "fullname"; }
private void buInsererAdresse_Click(object sender, EventArgs e) { poRange = Globals.ThisAddIn.Application.ActiveDocument.Content; try { String loAdresseSelectionnee = ((Xrm.contact)cbResultat.SelectedItem).fullname + "\n"; loAdresseSelectionnee += ((Xrm.contact)cbResultat.SelectedItem).address1_line1 + "\n"; loAdresseSelectionnee += ((Xrm.contact)cbResultat.SelectedItem).address1_postalcode + " "; loAdresseSelectionnee += ((Xrm.contact)cbResultat.SelectedItem).address1_city + "\n"; poRange.InsertAfter(loAdresseSelectionnee); } catch { MessageBox.Show("L'adresse du contact ne peut pas être ajoutée au document."); } }
function LectureSeule(){ var iLen = crmForm.all.length; for (i = 0; i < iLen; i++) { o = crmForm.all[i]; if (o.id != ""){o.Disabled=true;} } }
var crm = new Xrm.XrmDataContext("CRM");
System.Console.WriteLine("Liste des comptes situés à PARIS"); System.Console.WriteLine("========================================================="); var queryAccounts = from a in crm.accounts where a.address1_city == "PARIS" select a; foreach (var a in queryAccounts) { System.Console.WriteLine(a.name); } System.Console.ReadLine();
System.Console.WriteLine("Liste des comptes qui ont au moins un contact à PARIS"); System.Console.WriteLine("===================================================="); var queryAccounts = from a in crm.accounts join c in crm.contacts on a.accountid equals c.parentcustomerid.Value where c.address1_city == "PARIS" select a; foreach (var a in queryAccounts) { System.Console.WriteLine(a.name); } System.Console.ReadLine();
document.all.telephone1_c.style.backgroundColor = 'yellow'; document.all.telephone1_d.style.backgroundColor = 'yellow';Enregistrer et publier l'entité Compte.
/* Cache un élément graphique */ function CacheGraphique(sField){ var oField = document.getElementById(sField); if (oField != null){oField.style.display = "none";}} CacheGraphique("tab5Tab");
/* Champ requis */ function crmForm.ChampRequis(sField){ crmForm.all.item(sField).setAttribute("req", 2); crmForm.all.item(sField + "_c").className = "req"; crmForm.all.item(sField + "_c").innerHTML = crmForm.all.item(sField + "_c").innerText + ""; } /* Champ non requis */ function crmForm.ChampNonRequis(sField){ crmForm.all.item(sField).setAttribute("req", 0); crmForm.all.item(sField +"_c").className = "n"; crmForm.all.item(sField +"_c").innerHTML = crmForm.all.item(sField +"_c").innerText; } crmForm.all.hab_prime.onclick= function(){ if (crmForm.all.hab_prime.DataValue=="1"){crmForm.ChampRequis("hab_valeur"); } else{crmForm.ChampNonRequis("hab_valeur"); }}
// Cette ligne de code doit être appelée une seule fois, à l’initialisation de votre application System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback (myCertificateValidation); // Méthode myCertificateValidation bool myCertificateValidation(Object sender, System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors Errors) { return true; // Vous pouvez être beaucoup plus précis dans la sécurité à mettre en place }