Quantcast
Channel: Forum CRM Development
Viewing all 1000 articles
Browse latest View live

crm 2011 on-premise: problem setting up lookup field in C# plugin

$
0
0

I have a pre-create plugin on a phone call record and I am initializing its 'regardingobjectid' lookup field with a newly created case record as shown below. The problem is that the 'Regarding' field on the phonecall form shows no Text but just the icon for the Case record though the Title of the Case record is populated. The Case icon is clickable and leads to the Case record but I am not sure why there is no Text in the Lookup field.

'entity' is the phonecall record within the pre-create plugin:

entity.Attributes["regardingobjectid"] = newEntityReference("incident",newGuid(new_caseid.ToString()));

Can somebody help me figure out the best way to get the Case Title show up on the Lookup field? thanks!



CRM2011 Rollup12 - Call Dialog Workflow in JavaScript

$
0
0

Hello,

For CRM 2011 Rollup 12, is there a supported customization for calling a dialog workflow programmatically in JavaScript? The code snippet shown below is the method I have been using to call the dialog once business validation logic has been met. Upon return from ShowModalDialog I am reloading the window. ShowModalDialog is not supported by all browsers, and with HTML5 the third parameter containing style settings is no longer supported. The dialog comes up to the screen but only the bottom buttons on the dialog workflow are appearing.

      var recordId = window.parent.Xrm.Page.data.entity.getId();

      var serverUri = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');

      window.showModalDialog(serverUri + "?DialogId=" + "{20c40382-463c-4bc7-ab27-1f9e7d1cba16}" + "&EntityName=" + "new_myentity" + "&ObjectId=" + recordId, null, "width=615,height=480,resizable=1,status=1,scrollbars=1");

Any ideas for a supported customization would be greatly appreciated.

WendellGman

Plugin Error... Help!

$
0
0

Hi everyone,

I seem to get an error "The given key was not present in the dictionary".. Seems to be sometimes happening on create and always on the update.

I have goggled this error and it seems that I need to create a pre image on Update? I'm quite new in terms of developing Plugins so any advice would be really helpful.

I have commented out the section of the code which includes Pre Images. However, I'm not sure if I am on the right track,

namespace WeightedBant
{
    using System;
    using System.Collections.ObjectModel;
    using System.Globalization;
    using System.Linq;
    using System.ServiceModel;
    using Microsoft.Xrm.Sdk;

    /// <summary>
    /// Base class for all Plugins.
    /// </summary>    
    public class WeightedBant : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            ITracingService trace = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            try
            {
                trace.Trace("Entering the plugin");
                //Entity preImageEntity = null;
                //if (context.PreEntityImages.Contains("PreImage") && context.PreEntityImages["PreImage"] is Entity)
                //{
                //    preImageEntity = (Entity)context.PreEntityImages["PreImage"];
                //}
                Entity entity = (Entity)context.InputParameters["Target"];
#region Populating Bant Score
                //Declaring variables that will hold the OptionSet Values. It will be set to 0 if the user does not choose
                trace.Trace("Storing the OptionSet Values to variables");
                //int authorityValue;

                //if (((OptionSetValue)entity.Attributes["ap_authority"]).Value != null || preImageEntity.Attributes.Contains("ap_authority"))
                //{
                //    authorityValue = ((OptionSetValue)entity.Attributes["ap_authority"]).Value;
                //}

                //else
                //{
                //    authorityValue = 0;
                //}
                var authorityValue = entity.Attributes.Contains("ap_authority") ? ((OptionSetValue)entity.Attributes["ap_authority "]).Value : 0;
                var needValue = entity.Attributes.Contains("ap_need")?((OptionSetValue)entity.Attributes["ap_need "]).Value : 0;
                var budgetValue = entity.Attributes.Contains("ap_budget")?((OptionSetValue)entity.Attributes["ap_budget "]).Value : 0;
                var timeValue = entity.Attributes.Contains("ap_time")?((OptionSetValue)entity.Attributes["ap_time "]).Value : 0;

                //Calculates the total bantScore based on the Option Set Values and populates the ap_overallscore field.
                trace.Trace("Variables now contain Value. Calculate total");
                int bantScore = authorityValue + needValue + budgetValue + timeValue;

                trace.Trace("Populate ap_overallscore");
                entity["ap_overallscore"] = bantScore;

#endregion

#region Populating Lead Rating
                //Populating Lead Rating to Cold,Warm or Hot based on Bant Score.
                //3 = Cold. 2 = Warm. 1 = Hot

                trace.Trace("Populate Lead Rating");
                if (bantScore < 5)
                {
                    ((OptionSetValue)entity.Attributes["leadqualitycode"]).Value = 3;
                }
                else if (bantScore >= 5 && bantScore <= 12)
                {
                    ((OptionSetValue)entity.Attributes["leadqualitycode"]).Value = 2;
                }
                else
                {
                    ((OptionSetValue)entity.Attributes["leadqualitycode"]).Value = 1;
                }
            }
#endregion
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(" CRM has encountered an error when calculating the Weighted Bant. Message: " + ex.Message + ". InnerException: " + ex.InnerException);
            }
        }
    }
}

Mark E-Mail Activity as Task to show up in the ToDo list of Outlook 2010

$
0
0

Hi,

I'm creating an E-Mail activity as follow

Email followUpMail = new Email { 
                    Subject = "Follow up: " ,
                    ActivityId = Guid.NewGuid(),
                    To = objtoParty,
                    From = objfromParty,
                    Description = "Dear "+ crmContact.FirstName + " " +crmContact.LastName+", " +System.Environment.NewLine + "Please Add text"+
                                    System.Environment.NewLine + "Regards"+ System.Environment.NewLine,
                    RegardingObjectId = foundOppertunity.ToEntityReference(),
                    ScheduledStart = DateTime.Now.AddDays(14),
                };
                _service.Create(followUpMail);

Now this E-Mail shows up in my Activity list as id should be. So far so good.

If I flag this E-Mail manually ( the red flag symbol) I will show up in my ToDo List of Outlook as well.

Is there any chance to solve this programmitcally?

In a way that the E-Mail - Acitivy created shows up in the ToDo list of Outlook, including reminder?

If I create a new Outlook Item Email and mark it as task I get an error stating that only send or received E-Mails can be marked as task, therefore I rely on the E-Mail activity task of ms CRM.

Thanks a lot

Ben

Concating a CRM 2011 name field to contain 2 lookup fields and 1 text field

$
0
0

I am trying to set the name field on a custom entity with two look up fields and one text field on save of the form. Below is my code. I continue to get the error "Object doesn't support property or method 'getattribute'"

Any chance you could look at the code and help with where this error is coming from.

With great gratitude! Jenn

function concatName()
	{
		var dateIdentified = Xrm.Page.getattribute("nhs_dateidentified");
		var SIR = Xrm.Page.getattribute("nhs_sir");
		var carrierID = Xrm.Page.getattribute("nhs_carrierid");
		var name = Xrm.Page.getattribute("nhs_name");
		{
		if ((dateIdentified !=null) && (carrierID !=null))
			{
			var dateIdentifiedname = dateIdentified.getValue();
			var carrierIDName = carrierID.getValue();
			}
			{
			if ((dateIdentifiedname !=null) && (SIR !=null) &&(carrierIDName !=null) && (name == null))
			name = dateIdentifiedname + seperator + SIR + seperator + carrierIDName;
			}
	Xrm.Page.getAttribute("nhs_name").setValue(name);
		}
	}

oData: how do I retrieve the GUID of a record returned by a query?

$
0
0

Hi there,

I need to fetch the GUID of a parent account for a contact through the use of JScript.

Through oData, I managed to fetch the correct record as follows:

	if(Xrm.Page.getAttribute("customerid").getValue()!=null) {
		if(Xrm.Page.getAttribute("customerid").getValue()[0].typename=="contact") {
		alert ("this op is bound to a contact");
		var idCustomer = Xrm.Page.getAttribute("customerid").getValue()[0].id;
		var retrieveRecordsReq = new XMLHttpRequest();
		var ODataPath = Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc";
		var filter = "/ContactSet?$filter=parentcustomerid/Id eq guid'" + idCustomer + "'";

However I am mot sure how I could proceed from here to fetch the GUID of the parent account and store it in a variable. Could someone please advise?

Regards,
P.


MCC, MCT, MCP, MCTS
If you find this post helpful then please "Vote as Helpful". If I helped you with an answer to a question then please "Mark As Answer".

IE 10 issue

$
0
0
I am getting error 'XPathEvaluator' is undefined in IE 10 with the JavaScript provided in CRM SDK. Script working fine in other versions of IE. Does any one have a work around for this issue?

CreateXMLHttp() is undefined

$
0
0

This is some code I created last summer and finally it is time to get some use.  It worked perfectly fine in our test crm 2011 environment up until now.  I have not changed anything from the last time it worked.  The only thing I can think of is that one of the CRM Rollups changed this so it would not work anymore.  Basically I need to perform a fetch to get information from a contacts account.  That information is passed into an iframe. Now I keep getting an error saying "CreateXmlHttp is undefined".  Any help is appreciated.

<script src="/company/WebResources/ClientGlobalContext.js.aspx"></script>  <SCRIPT type=text/javascript>
function load()
{
	var context = GetGlobalContext();
	var header = context.getAuthenticationHeader();
    var names = window.parent.Xrm.Page.getAttribute("parentcustomerid").getValue();
	var lookup = new Array;
	lookup = names;
	var company = lookup[0].name;
		var Xml = "<?xml version='1.0' encoding='utf-8'?>"+ "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ 
		header +"<soap:Body>"+ "<Fetch xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<fetchXml>&lt;fetch mapping='logical'&gt;"+ "&lt;entity name='account'&gt;"+ "&lt;attribute name='name'/&gt;"+ "&lt;attribute name='accountnumber'/&gt;"+ "&lt;filter type='and'&gt;"+ "&lt;condition attribute='name'"+" operator='eq' value='"+company+"'/&gt;"+ "&lt;/filter&gt;"+ "&lt;/entity&gt;"+ "&lt;/fetch&gt;</fetchXml>"+ "</Fetch>"+ "</soap:Body>"+ "</soap:Envelope>";

		var XmlHttp = CreateXmlHttp();

		XmlHttp.open("POST", 'http://testcrm/mscrmservices/2007/crmservice.asmx', false);
		XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
		XmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
		XmlHttp.setRequestHeader("Content-Length", Xml.length);
		XmlHttp.send(Xml);
		var resultDoc = loadXmlDocument(XmlHttp.responseXML.text); 
		var resultnames = resultDoc.selectNodes("//accountnumber");
	var mail = window.parent.Xrm.Page.getAttribute("emailaddress1").getValue();
	var first = window.parent.Xrm.Page.getAttribute("firstname").getValue();
	var last = window.parent.Xrm.Page.getAttribute("lastname").getValue();
	var address = "Http://testcrm/Users/Default.aspx?Param1="+mail+"&Param2=" + resultnames[0].text + "&Param3=" + first + " " + last;
   ifrm = document.createElement("IFRAME"); 
   ifrm.setAttribute("src",address);
   ifrm.style.width = 100+"%"; 
   ifrm.style.height = 100+"%"; 
   document.body.appendChild(ifrm); 
}</SCRIPT>


Error in Silverlight Application Property 'Xrm' is null and the Global Context is not available.

$
0
0

I have place one button in dashboards ribbon in ms dynamic crm 2011. I have created one simple silverlight application. I have successfully open this page on button click after uploading .xap and .html page in ms dynamic CRM solution. But getting error on Proceed button click which is place on silverlight page for second last line of                 

IOrganizationService myservice = SilverlightUtility.GetSoapService();:


Here is button click:

private void btnProceed_Click(object sender, RoutedEventArgs e)
        {

            foreach (var item in dataGrid1.ItemsSource)
            {
                string name = ((TextBox)dataGrid1.Columns[1].GetCellContent(item).FindName("txtName")).Text;
                string amount = ((TextBox)dataGrid1.Columns[4].GetCellContent(item).FindName("txtAmount")).Text;

                Entity entity = new Entity();
                entity.LogicalName = "new_test";
                entity.Id = new Guid();
                entity["new_name"] = name;
               
                IOrganizationService myservice = SilverlightUtility.GetSoapService();
                myservice.BeginCreate(entity, new AsyncCallback(CreateContact), myservice);

            }
}


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/2; AskTbARS/5.14.1.20007)
Timestamp: Fri, 11 May 2012 04:18:22 UTC


Message: Unhandled Error in Silverlight Application Property 'Xrm' is null and the Global Context is not available.   at SampleExpense.SilverlightUtility.GetContext()
   at SampleExpense.SilverlightUtility.GetServerBaseUrl()
   at SampleExpense.SilverlightUtility.GetSoapService()
   at SampleExpense.MainPage.btnProceed_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
URI: https://crm5org9cf5c.crm5.dynamics.com//WebResources/new_/SampleExpenseTestPage.html

Set a value for a lookup field on header when onload form in crm

$
0
0

Dear all,

In the header of form, I've a lookup field A.

And when the form is in the creating,  I want to set a value for this field A.

I've try Xrm.Page.getAttribute(aFieldId) or document.getElementById(aFieldId) but it return null.

So how i can set value for this in the onload JScript?

Thanks,


If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

Using a CRM4 ISV app under CRM 2011 claim based

$
0
0

Hi,

We have done a conversion from CRM4 to CRM2011 and we have a webpage under the ISV folder that connect to the CRM through the CRM4 SDK. Our webpage works fine under our CRM2011 website through an Iframe. But when we enable claim based, it doesn't works anymore... I did add a relying party to my ADFS 2.0 from my application under ISV. I get this error : UserId not found for the current user on the context 

What I understant is that my code wich try to Extract my crm authentication token, want to get the UserId property from my context, but since I get a claims from ADFS, I don't have this property in my identity. What I want to know is : is it even possible to do something like this ? My code is almost exactly the same from the SDK example IFDBackComp. Thanks


getting value in javascript from aspx to codebehind

$
0
0

Hi,

I am trying to transmit incidentid that i get on crmform.objectid from aspx to codebehind in C#. I put this value in hiddenfield. On the client i had the value.

But on C# when i call hiddenfield.value, i got null. How can i resolve this problem?

Thanks for your help.

Here is some sample:

Aspx:

 <script type="text/javascript">


        
        /*****************Fonction  pour recupérer les activités de l'incident***************/
        function RecupererActivites() {
            var incidentid;
           
            if (window.parent.crmForm.ObjectId != null) {
                incidentid = window.parent.crmForm.ObjectId;

                document.getElementById("hdnIncidentId").value = incidentid;

             var IncidentID = document.getElementById("hdnIncidentId").value;
               // alert("identifiant de ***a : " + IncidentID);

            } //end if
            else {

                alert("id null ou non défini");
            }
           

        } //end function

        /***********************************************************************/

     
    </script>
</head>
<body>
    <form id="form1" runat="server" style="font-family: Arial; font-size: 11px; " >
    <asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" />
    
         <div>
                <asp:HiddenField ID="hdnIncidentId" runat="server" Value="" />
                
            </div>
       
            <div>
                <asp:GridView runat="server" ID="DetailsView" Style="font-family: Tahoma;" Font-Size=" 11px" />
            </div>
             <div style="width: 578px; height: 40px; overflow: hidden;">
                <asp:PlaceHolder ID="errorHolder" runat="server" />
            </div>
       
    
    </form>
</body>
</html>

C# code:

 protected void Page_Load(object sender, EventArgs e)
    {

        Response.AddHeader("pragma", "no-cache");
        Response.CacheControl = "no-cache";
        if (!IsPostBack)
        {
            try
            {
                crmService = GetCrmService("http://crm", "AccessDiffusion");
                
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "RecupererActivites();", true);
                Monincidentid = hdnIncidentId.Value;
                
                l.Text = "l'id de l'incident " + Monincidentid;
                errorHolder.Controls.Add(l);
               // ShowDetailIncident(Monincidentid);
            }
            catch (System.Web.Services.Protocols.SoapException soap)
            {
                l.Text = soap.Detail.OuterXml;
                errorHolder.Controls.Add(l);
            }
        }
    }

THANKS

CRM 2011: User should not be allowed to block(inactive) account

$
0
0

Hi,

I have complex scenario, Account has 2 status reason for inactive status - Inactive & Block.

User should be allowed to deactivate account as Inactive only and not Block.

I can handle this through plugin on statechange message but challenge is there is one utility through which account status reason is set to block and dont want to stop this.

Need urgent help please!!

 


Garfield!!

CRM 2011 Javascript : Date fields becoming null on Save

$
0
0

I have an issue regarding CRM 2011 DateTime field..

The scenario is this, I have 10 Date fields in my form..

After I set a value on "datefield_1", the "datefield_2" value should then be Required, onLoad using JScript, (and so on, so forth)

The problem is this, when I reach and populate the "datefield_4", and then save it,  the values of datefields 2 and 3 is becoming null on load.

I have a JScript that sets the requirement level to business required on form onLoad if the previous datefields are != null. And I have no scripts that sets  ANY value to null.

( I am using CRM Online)



How to fetch the users with their CAL types?

$
0
0

Hi All,

I need to fetch the crm 2011 users with their CAL types.Any help?

Thanks,

Mohak


MSCRM Can i set this base on current date and field By using Javascript???

$
0
0

Hi, I have 2 different field in my form (Timeline and Est. Close Date)

Example:
Today is 16/4/2013
In Timeline I select "This Year"
So, In Est. Close Date will auto populate date base on Current Date & Timeline, which is 31/12/2013

Just like :

Inside my Timeline I have (This Month, This Quarter, Next Quarter, This Year and next year)

Thank you!!


Stream SSRS report to PDF from plugin

$
0
0

Hello,

I'm having problems finding CRM 2011 examples of streaming an SSRS report to PDF format from a plugin.  I want to be able to stream an SSRS report to PDF and store the PDF in a server location.

I'm trying to make this code work with the canned CRM 2011, reports but ultimately I want to be able to use the same process against custom CRM reports.

All the examples I find are related to CRM 4.0 and don't work in CRM 2011.

I've been trying to use the following code as a basis for the PDF stream:

ReportExecutionService rs = new ReportExecutionService();
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rs.Url = "http://SQL1/reportserver/ReportExecution2005.asmx";// Setting Report Parameters// 1. Report path from report server// 2. Output format// 3. Device Infostring reportPath = "/SharedReports/5.0.xxxx/1033{3C3CA962-D4E0-4E62-A9B4-36F00C484D36}";string format = "PDF";string historyID = null;string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";// Passing parameters to report
            ParameterValue[] parameters = new ParameterValue[7]; // Define parameters
            parameters[0] = new ParameterValue();
            parameters[0].Name = "CRM_FilterText";
            parameters[0].Value = "";
            parameters[1] = new ParameterValue();
            parameters[1].Name = "CRM_FormatDate";
            parameters[1].Value = "";
            parameters[2] = new ParameterValue();
            parameters[2].Name = "CRM_FormatTime";
            parameters[2].Value = "";
            parameters[3] = new ParameterValue();
            parameters[3].Name = "CRM_FullName";
            parameters[3].Value = "AccountOverview";
            parameters[4] = new ParameterValue();
            parameters[4].Name = "CRM_URL";
            parameters[4].Value = "http://SQL1/reportserver/ReportService2005.asmx";
            parameters[4].Value = "String";
            parameters[5] = new ParameterValue();
            parameters[5].Name = "SubEntities";
            parameters[5].Value = "";
            parameters[6] = new ParameterValue();
            parameters[6].Name = "CRM_NumberLanguageCode"; 
            parameters[6].Value = "";string encoding;string mimeType;string extension;
            Warning[] warnings = null;string[] streamIDs = null;
            ExecutionInfo execInfo = new ExecutionInfo();           
            ExecutionHeader execHeader = new ExecutionHeader();
            rs.ExecutionHeaderValue = execHeader;
            execInfo = rs.LoadReport(reportPath, historyID);
            rs.SetExecutionParameters(parameters, "en-us");
            String SessionId = rs.ExecutionHeaderValue.ExecutionID;// Data Source settings
            DataSourceCredentials[] credentials = new DataSourceCredentials[1];
            DataSourceCredentials dsc = new DataSourceCredentials();
            dsc.DataSourceName = "CRM";
            dsc.UserName = "kcguise";
            dsc.Password = "password";
            credentials[0]=dsc;
            rs.SetExecutionCredentials(credentials);// Generating reportbyte[] result = null;try
            {          
                result = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
            }catch (SoapException err)
            {thrownew Exception(err.Detail.OuterXml);
            }//Encoded data is pdf
            String encodedData = System.Convert.ToBase64String(result);       

The main problem I have is that I don't know how I should set the DataSourceCredentials, and that is where I'm getting a problem. With the above code I get the following error:

{"An error has occurred during report processing. ---> 
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: 
An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: 
Cannot create a connection to data source 'CRM'. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: \n
System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). ---> 
Microsoft.Crm.Reporting.DataExtensionShim.Common.
ReportExecutionException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."}

Supposedly, I'm to use the following code to figure out the DataSourceCredentials, but the problem is that the CrmAuthenticationToken does not seem to be supported in CRM 2011 anymore.

CrmAuthenticationToken token = new CrmAuthenticationToken();
            token.AuthenticationType = 0;
            token.OrganizationName = "CRM";
            CrmService.CrmService service = new CrmService.CrmService();
            service.CrmAuthenticationTokenValue = token;
            service.UseDefaultCredentials = true;//Get Credentials
            WhoAmIRequest req = new WhoAmIRequest();
            WhoAmIResponse whoami = (WhoAmIResponse)_service.Execute(req);string userName = whoami.UserId.ToString();string password = whoami.OrganizationId.ToString();//Create DataSourceCredentials for SRS
            DataSourceCredentials dsc = new DataSourceCredentials();
            dsc.DataSourceName = "CRM";
            dsc.UserName = userName;
            dsc.Password = password;

Does anyone have a working example of streaming an SSRS report in PDF format. Or could you provide some insight on how to get around the DataSourceCredentials issue?

Pull Look Up Values from another form to new form.

$
0
0

Hello Everyone,

I'm trying to pull look up values from one form to another. For example, I have an Opportunity with a company name look up value and a contact look up value. I have a custom entity that I can create referencing that Opportunity. When I create this new record the Opportunity is automatically included in the look up value. I want to also include the look up value for the company name and contact on this new custom entity record from that Opportunity.

How difficult is this to code? Does anyone have some help pointers or perhaps blogs that I could reference to point me in the right direction and get me started?

Thanks for all help,

-Trevor

Calling web service from CRM 2011 (On Premise) with Javascript

$
0
0

I have had some Javascript sitting in a test environment for months and last summer this worked fine.  I know its the Javascript because I tested my web service and that is working fine.  When I debug the JS it shows no errors.  Nothing shows up in the server logs so I have no idea why this is not working.  It is like the Javascript just won't send or the webservice isn't doing anything to this call. 

The asmx is called CreateRoles.  There are 2 web methods in there called CreateRole and DeleteRole. Which control role creation in our FBA database.

function Form_onload()
{
crmForm.all.connect_akcelerantconnect.onclick = function()
 {
	var value = crmForm.all.checkbox.DataValue;
	var name = crmForm.all.textbox.DataValue;

		if(value == true)
		{

			var xml = "<?xml version='1.0' encoding='utf-8'?>" +"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' "+" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+"<soap:Body>" +"<createrole xmlns='http://tempuri.org/'>" +"<name>" + name + "</name>" +"</createrole>" +"</soap:Body></soap:Envelope>";

				var xmlHttp;
				if (window.XMLHttpRequest)
				{
					xmlHttp = new XMLHttpRequest();
				}
				else
				{
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
			xmlHttp.open("POST","http://localhost/Site/CreateRoles.asmx?wsdl", true);
			xmlHttp.setRequestHeader("Content-Type","text/xml; charset=utf-8?");
			xmlHttp.setRequestHeader("Content-Length",xml.length);
			xmlHttp.send(xml);
			Xrm.Page.data.entity.save();
		}
		else
		{
			if(confirm("Do you want to procede?"))
			{
				var xml = "<?xml version='1.0' encoding='utf-8'?>" +"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' "+" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+"<soap:Body>" +"<deleterole xmlns='http://tempuri.org/'>" +"<name>" + name + "</name>" +"</deleterole>" +"</soap:Body></soap:Envelope>";

				var xmlHttp;
				if (window.XMLHttpRequest)
				{
					xmlHttp = new XMLHttpRequest();
				}
				else
				{
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				xmlHttp.open("POST","http://localhost/Site/CreateRoles.asmx?wsdl", true);
				xmlHttp.setRequestHeader("Content-Type","text/xml; charset=utf-8?");
				xmlHttp.setRequestHeader("Content-Length",xml.length);

				xmlHttp.send(xml);
				Xrm.Page.data.entity.save();
				
			}
			else
			{
				crmForm.all.checkbox.DataValue = true;
			}
			
		
	
		}
	}
}

Yes the function On_load is enabled in the form properties.

Here is the service

<System.Web.Script.Services.ScriptService()> _<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class CreateRoles
    Inherits System.Web.Services.WebService<WebMethod()> _
    Public Sub CreateRole(ByVal Name As String)
        If Not Roles.RoleExists(Name) Then
            Roles.CreateRole(Name)
        End If
    End Sub<WebMethod()>
    Public Sub DeleteRole(ByVal Name As String)

        If Roles.RoleExists(Name) Then
            Dim Users() As String = Roles.GetUsersInRole(Name)
            If Users.Length > 0 Then
                For Each Person As String In Users
                    Dim UserRoles() As String = Roles.GetRolesForUser(Person)
                    Roles.RemoveUserFromRoles(Person, UserRoles)
                    Membership.DeleteUser(Person)
                Next
            End If
            Roles.DeleteRole(Name)
        End If
    End Sub
End Class

Any and all help is appreciated

attachevent on SubGrid onrefresh event

$
0
0

I wrote some some JavaScript code in CRM 4.0 that triggers when the datagrid inside of an IFrame refreshes.  I have upgraded the system to CRM 2011 and changed the IFrame to a SubGrid.  Now I am trying to use JavaScript to attach the function to the onrefresh event and can't seem to get it to work.

This is the old code I need to reproduce.

if (crmForm.FormType != 1) {

    crmForm.all.IFRAME_OpportunityLines.src = GetFrameSource("fj_opportunity_new_opportunitymanagementmodu");
    crmForm.all.IFRAME_OpportunityLines.onreadystatechange = function oppLineTotals() {
        if (crmForm.all.IFRAME_OpportunityLines.readyState == 'complete') {
            var iFrame = frames[window.event.srcElement.id];
            iFrame.document.all.crmGrid.attachEvent("onrefresh", GridRefresh);
        }
    }
}

Any help would be appreciated.

Thanks
Viewing all 1000 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>