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

Phone Call in silverlight : How to assign value in 'To' and 'From '

$
0
0

Hi all,

I have to create phone call by silverlight application using Soap .I have create it but Value in To is  not assign.

  Entity entity = new Entity();
                entity.LogicalName = "phonecall";
                entity.Id = new Guid(); //if we will not pass, API will create

 entity["subject"] = txtSubject.Text;

  service.BeginCreate(entity, new AsyncCallback(CreateRecord), service);

 void CreateRecord(IAsyncResult result)
        {
            Guid id = ((IOrganizationService)result.AsyncState).EndCreate(result);
            Deployment.Current.Dispatcher.BeginInvoke(delegate { SetStateCode(id); });
        }

 void SetStateCode(Guid recordId)
        {

            Entity from = new Entity();
           // from = new Entity();
            from.LogicalName = "activityparty";
            from["partyid"] = new EntityReference() { LogicalName = "contact", Id = new Guid("6A6964DA-1BAB-E211-BC1B-984BE173A3B9")

};
            from["activityid"] = new EntityReference() { LogicalName = "phonecall", Id = recordId };

            OptionSetValue osv = new OptionSetValue();
            osv.Value = 1;//for "sender" field

            from["participationtypemask"] = osv;

            IOrganizationService service = SilverlightUtility.GetSoapService();
            service.BeginCreate(from, new AsyncCallback(CreateToOrFrom), service);

}

Any Suggestion or link

 


Hope this helps. ----------------------------------------------------------------------- Santosh Bhagat If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"


How to get current user Business Unit Details in CRM 2011 using C# Plugin

$
0
0

Hi,

How to get the details of  "Business Unit"  of current Loggedin user  in CRM 2011 using C# Plugin.

Thanks,

Kranthi

Issue while creating a Team using Dynamics CRM Plugins

$
0
0

Hi,

I am developing a plugin to create a team dynamically. I am getting some issue related to the business unit id.

Below are the code.

var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));


//Create the organization service
IOrganizationService service = factory.CreateOrganizationService(context.UserId);

ColumnSet allFields = new ColumnSet() { AllColumns = true };
Entity user = service.Retrieve("systemuser", context.UserId, allFields);

//get business unit lookup
Guid businessUnitId = ((EntityReference)user.Attributes["businessunitid"]).Id;


//create a team
Entity team = new Entity("team");
team["name"] = "Test Team";
team["businessunitid"] = businessUnitId;
team["administratorid"] = context.UserId;
// Create the team in Microsoft Dynamics CRM.
service.Create(team);

I am getting an error "Attribute: businessunitid cannot be set to NULL" on "service.Create(team)" line. I debug the code and found that I am getting Business Unit ID correctly.

Can anyone help me to fix this.

Thanks and Regards

Sandeep

CloudFronts Technologies

www.cloudfronts.com

calling retrieveRecord in sdk.jquery.js returns undefined in success callback

$
0
0

Hi

I am creating a web resource according to this sample, I can call retrieveMultipleRecords from SDK.Jquery.JS library and get results but when I call retrieveRecord, in it success call back I got undefined as a result. I checked it implementation and I saw that there was not any error and ajax call returns  xhr.responseText 

here is the js code I Use:

$(function () {

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

});

function FillContactsList(recordid)
{
   var _results=null;

   SDK.JQuery.retrieveMultipleRecords("new_customEntity","$filter=new_course/Id eq guid'"+recordid+"'",function(results) {    
   _results= results;
   if(_results!=null)
	{
		$.each(_results, function() {
			 $('#studentsList').append(this.new_student.Name+'\n');
			 GetContactMobile(this.new_student.Id);
		});
	}
   },function(x){alert(x.message)},function(){});

   
   
   
}



function GetContactMobile(id)
{
 
 SDK.JQuery.retrieveRecord(
     id,
     "Contact",	
     null, null,
     function (c) {
		$('#studentsList').append(c.mobilephone);
     },
     function(x){alert(x.message)}
   );
}


So What Should I Do ?


How to set the value of a field based on another field value

$
0
0

Hi,

First I new working with CRM 2011.

In the opportunity form there are 2 custom fields. the 1e is a option set and the 2e should be file in base on the value of field 1.

I have created a websource with the below value and set the OnChange on field 1. But I get a error message, can someone help me.

Thanks.

function Fasefield() {
 var proces = Xrm.Page.getAttribute("new_verkoopproces").getValue;
 var fase = Xrm.Page.getAttribute("new_fasepercentage");
 if proces == ('Prospect') { 
  Xrm.Page.getAttribute("new_fasepercentage").setValue('0');
 }
 else if proces == ('Appointment') {
  Xrm.Page.getAttribute("new_fasepercentage").setValue('10');
 }
 else if proces == ('Demonstration') {
  Xrm.Page.getAttribute("new_fasepercentage").setValue('15');
 }
 else if proces == ('Acceptation') {
  Xrm.Page.getAttribute("new_fasepercentage").setValue('50');
 }
 else if proces == ('Contracting') {
  Xrm.Page.getAttribute("new_fasepercentage").setValue('75');
 }
 else if proces == ('Ordering') {
  Xrm.Page.getAttribute("new_fasepercentage").setValue('100');
 }
}

CRM 2011 - Cannot connect to IFD with external application - "The user authentication failed!"

$
0
0

Whenever our custom application attempts to connect to a system set up with IFD, we receive this error.  "The user authentication failed!".  This application works in every scenario except with IFD.

 

private void WorkerFunction() {
	OrganizationServiceProxy serviceProxy;
	IOrganizationService service;

	//Create Connection
ServerConnection serverConnect = new ServerConnection(); ServerConnection.Configuration config = serverConnect.GetServerConfiguration(new Uri(myCRMService).Authority, myCRMuser, myCRMpass, myCRMdomain, myCRMOrgName); using (serviceProxy = new OrganizationServiceProxy(config.OrganizationUri, config.HomeRealmUri, config.Credentials, config.DeviceCredentials)) { serviceProxy.EnableProxyTypes(); // This statement is required to enable early-bound type support. service = (IOrganizationService)serviceProxy; //code
//code
//code
}
}

 

//Build Credentials
public class Configuration
{
public String ServerAddress;
public String OrganizationName;
public Uri DiscoveryUri;
public Uri OrganizationUri;
public Uri HomeRealmUri;
public ClientCredentials DeviceCredentials;
public ClientCredentials Credentials;
public AuthenticationType EndpointType;
}

public List<Configuration> configurations = null; private Configuration config = new Configuration(); public virtual Configuration GetServerConfiguration(string URL, string userName, string password, string domain, string org) { if (URL.EndsWith(".dynamics.com")) //online { //config.DiscoveryUri = new Uri("https://dev." + URL + "/XRMServices/2011/Discovery.svc"); config.DiscoveryUri = new Uri("https://" + URL + "/XRMServices/2011/Discovery.svc"); config.DeviceCredentials = GetDeviceCredentials(); config.OrganizationUri = new Uri("https://" + org + ".api.crm.dynamics.com/XRMServices/2011/Organization.svc"); // Get the target organization. } else //onPremise or IFD { config.DiscoveryUri = new Uri("https://" + URL + "/XRMServices/2011/Discovery.svc"); //config.DiscoveryUri = new Uri("http://" + URL + "/XRMServices/2011/Discovery.svc"); config.OrganizationUri = GetOrganizationAddress(config.DiscoveryUri); // Get the target organization. } config.Credentials = new ClientCredentials(); if (GetServerType(config.DiscoveryUri) == AuthenticationProviderType.ActiveDirectory) { config.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential(userName, password, domain); } else if (GetServerType(config.DiscoveryUri) == AuthenticationProviderType.LiveId) { config.Credentials.UserName.UserName = userName; config.Credentials.UserName.Password = password; } else if (GetServerType(config.DiscoveryUri) == AuthenticationProviderType.Federation) { config.Credentials.UserName.UserName = userName; config.Credentials.UserName.Password = password; } if (configurations == null) configurations = new List<Configuration>(); //Store the completed configuration. configurations.Add(config); return config; }

 

EDIT:  So as I'm researching, I'm learning more about claims based authentication and I'm having trouble finding good examples of code on how to create and use claims.  Can anybody point me in the right direction?  Also, do I need to use Windows Identity Foundation if this application runs on the same machine as CRM?







How to impersonate login user under IFD deployment?

$
0
0
Our application is using SOA architecture. Our WCF services are complete separate from our web application. We use WCF services to retrieve data from Dynamics web service.

In my service layer, I hope to make crmservice calls using login user account instead of a generic super user account. So that I can retrieve data base on login user's privilege.

From http://msdn.microsoft.com/en-us/library/cc151052.aspx article, it usestoken.CallerId to specify the current login user's ID. However, this solution doesn't seem to work on IFD mode. The result is always based on the user that we used to request ticket not the user we specify in callerID.

Is there any way that I can use similar (token.CallerId ) way to impersonate login user in the IFD mode?

Thanks in advance,

Darren

CRM 2011 plugin: system.ArgumentException: An item with the same key has already been added

$
0
0

Hi All,

I am new to plugins development. I am trying to retrieve 3 attributes from an entity called 'sample entity', then subtract 2 attributes and update the third one.

example: attributes are

field 1, field 2, field 3. 

field 3 = field 1 - field 2. These attributes are decimal numbers in CRM 2011

I want the plugin to fire when the form is updated. So I have made the execution on post-operation.

The code is below,

                                                  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
using System.ServiceModel;
using Microsoft.Xrm.Sdk.Query;


namespace samplePlugin
{
    public class Plugin : IPlugin
    {
        public void Execute(IServiceProvider serviceprovider)
        {
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)serviceprovider.GetService(typeof(IPluginExecutionContext));


            // The InputParameters collection contains all the data passed in the message request.
            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {
                // Obtain the target entity from the input parmameters.
                Entity entity = (Entity)context.InputParameters["Target"];

           

           try
                {
                  // Retrieve the days used and subtract it from Total Allowance
                         
                  decimal oDaysUsed = entity.GetAttributeValue<decimal>("tcrmb_daysused");
                  decimal oTotalAllowance = entity.GetAttributeValue<decimal>("tcrmb_totalallowance");
                 // decimal oDaysAvailable = entity.GetAttributeValue<decimal>("tcrmb_daysavailable");

                  decimal oAvailable = oTotalAllowance - oDaysUsed;
                  entity.Attributes.Add("tcrmb_daysavailable", oAvailable);               
                }



                catch (FaultException ex)
                {
                    throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);
                }
            }
        }
    }
}

Kindly have a look and let me know please

Regards,

Paul



Can I disable the login prompt for MS CRM 2011 SDK if credentials are wrong?

$
0
0
Right now I access the CRM SDK as follows

    IServiceManagement<IDiscoveryService> serviceManagement =
                            ServiceConfigurationFactory.CreateManagement<IDiscoveryService>(discoveryUri);
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = new System.Net.NetworkCredential(userName, password, domain);
    using (DiscoveryServiceProxy serviceProxy = new DiscoveryServiceProxy(new DiscoveryServiceProxy(serviceManagement, credentials))
    {
        RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
        RetrieveOrganizationsResponse orgResponse =
                    (RetrieveOrganizationsResponse)service.Execute(orgRequest);
        // do something with organisations
    }



However, if the domain credentials are incorrect, a Windows login prompt appears (somewhere in service.Execute). I don't want that login prompt. I have worked around this issue by validating the credentials using PrincipalContext before passing them to the DiscoveryServiceProxy, but I'm not entirely happy with that, as it does not work for IFD accessed from another domain.

Is there a way to disable the login prompt?

Modifying a Plugin to Sum Values of a Record and populate the total

$
0
0

Hello, 

I have an entity called new_accrued_billing that I've setup as a sub grid in the project module so you can click in the grid from within a project and create a record. My next requirement involves summing the values of 1 field in the Subgrid Records and summing them into a field on the project module. I've modified an existing plugin (that does the same thing for Time Entries on a project). 

 decimal Billed = 0;
               // decimal NonBillable_Total = 0;
                lastAction += "\nRun Totals For loop";
                if (Project_Billing != null)
                {
                    lastAction += "\nTime Entry is not null " + Project_Billing.Count.ToString();
                    if (Project_Billing.Count > 0)
                    {
                        lastAction += "\nCount is not null eric " + Project_Billing.Count.ToString();
                        foreach (Entity Project_Billings in Project_Billing)
                        {
                          Billed += (Convert.ToDecimal(Project_Billings["new_billed"].ToString()));
                        }
                     }
                 }

                Entity updateProject = new Entity();
                updateProject.LogicalName = "new_project";
                updateProject.Id = parentEvent.Id;
                updateProject["new_billing_summary"] = Convert.ToDecimal(Billed.ToString());
               // updateProject["new_nonbillabletime"] = Convert.ToDecimal(NonBillable_Total.ToString());
                lastAction += "\nAttempting Update " + updateProject.Id.ToString();

                try 
                {
                    crmService.Update(updateProject);
                }
                catch (FaultException e)
                {
                    lastAction += "\nError: " + e.Message;
                    throw new InvalidPluginExecutionException("Fault Exception: " + lastAction);
                }

	}//try
                try 
                {
                    crmService.Update(updateProject);
                }
                catch (FaultException e)
                {
                    lastAction += "\nError: " + e.Message;
                    throw new InvalidPluginExecutionException("Fault Exception: " + lastAction);
                }

	}//try

It compiles successfully and registers however I receive the following error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Catch All Exception: 
tracingService setup for Project_Billing_Rollup
serviceFactory set
service set
MessageName = Create
Create Message
Comes to Billing Entry
Parent Obtained 
Run Totals For loop
Time Entry is not null 3
Count is not null eric  3Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147220891</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <d2p1:key>OperationStatus</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">0</d2p1:value>
    </KeyValuePairOfstringanyType>
  </ErrorDetails>
  <Message>Catch All Exception: 
tracingService setup for Project_Billing_Rollup
serviceFactory set
service set
MessageName = Create
Create Message
Comes to Billing Entry
Parent Obtained 
Run Totals For loop
Time Entry is not null 3
Count is not null eric  3</Message>
  <Timestamp>2013-05-02T20:29:43.7746617Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText>

[Billing_Summary_Rollup: Project_Billing_Rollup.Project_Billing_Rollup]
[ Project_Billing_Rollup.Project_Billing_Rollup: Create of new_accrued_billing]
</TraceText>
</OrganizationServiceFault>

Any suggestions would be great! 

Thanks!

Eric

How to open user query form with Xrm.Utility.openEntityForm?

$
0
0

Hi,

I am using Xrm.Utility.openEntityForm to open entity records in new window. It works fine with some entities, but now I need to open user query and the function doesn't work. It just do nothing, no window is opened, no exception is thrown.

//this works fine
Xrm.Utility.openEntityForm("workflow","A45C0292-DF8B-E111-997C-A0155D8A8410");
//this doesn't work
Xrm.Utility.openEntityForm("userquery","B85C1252-EA84-3101-69AC-11155D8T8317");

What shall I do to open user query form with this function?

Thanks for replies,

Tom

CRM 2011: Get form name using javascript

$
0
0

Hi all, Is there anyway to get the form name using java script ?

I have an entity with two forms, I need execute some code in one of them only, not in both forms.

Anyway to do it ??

Thanks and best regards..

Plugin - Constructor Not Found

$
0
0

I am getting the following error when running a plugin on CRM Online.  This error shows in the System job for the plugin.

Unexpected exception from plug-in (Constructor): MYC.Plugin: System.MissingMethodException: Constructor on type 'MYC.Plugin' not found.

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unexpected exception from plug-in (Constructor): MYC.Plugin: System.MissingMethodException: Constructor on type 'MYC.Plugin' not found.Detail: <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"><ErrorCode>-2147220956</ErrorCode><ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /><Message>Unexpected exception from plug-in (Constructor): MYC.Plugin: System.MissingMethodException: Constructor on type 'MYC.Plugin' not found.</Message><Timestamp>2013-05-15T20:26:11.6240733Z</Timestamp><InnerFault i:nil="true" /><TraceText>

[MYC: MYC.Plugin]
[6be6af93-82bd-e211-951f-78e7d162bad9: MYC.Plugin: Update of salesorder]


</TraceText></OrganizationServiceFault>

Here is my C# code file - this is the only file in the project. I compiled it with VS 2012 Pro (target framework .NET 4.0)

using System;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;

namespace MYC.Plugin
{
    public class OrderStatus : IPlugin
    {
        private Guid _cid = context.primaryentityid;
        //public OrderStatus();

        public void Execute(IServiceProvider serviceProvider)
        {
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context =
                (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            // Get a reference to the organization service.
            IOrganizationServiceFactory factory =
                (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = factory.CreateOrganizationService(context.UserId);

            // Get a reference to the tracing service.
            ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            try
            {
                UpdateOrder(service, _cid, 220570000);
            }
            catch (FaultException<OrganizationServiceFault> ex)
            {
                // Handle the exception.
            }
        }


        private void UpdateOrder(IOrganizationService service, Guid _cid, int newstatus)
        {
            try
            {
                Entity _con = new Entity("Order");
                _con.Id = _cid;
                _con["statuscode"] = newstatus;

                service.Update(_con);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);

            }

        }
    }


}

Do I have to add a line for the constructor?  What do I put - and where?  

Thanks!

Error accessing CRM webservices (using SDK): 404 /adfs/ls/mex

$
0
0

Hello,

I'm trying to connect to the webservices of MS Dynamics CRM 2011 (configured with claims-based authentication) by using the examples from the SDK. I got CRM AND ADFS running on two different servers and it seems to work as expected. I can login from to my internal domain (internalcrm.contoso.com) within the Active Directory and also from outside via the organisation domain (org1.contoso.com).

But when I try to login with the SDK example projects I always get an error after entering my user credentials:

"The authentication endpoint Username was not found on the configured Secure Token Service!"

The error shows up very quickly (unusual for webservices ;-)) after entering the credentials. So I was curious an looked into the log IIS files:

2013-01-23 13:40:46 81.xx.xx.xx POST /adfs/ls/mex - 443 - 87.xx.xx.xx - - 404 0 2 93
2013-01-23 13:40:46 81.xx.xx.xx GET /adfs/ls/mex - 443 - 87.xx.xx.xx - - 404 0 2 78
2013-01-23 13:40:46 81.xx.xx.xx GET /adfs/ls/mex - 443 - 87.xx.xx.xx - - 404 0 2 59

As I understand it, my client (87.xx.xx.xx is my client's local IP) tries to communicate with my adfs server on path /adfs/ls/mex but gets a 404 error.

Does anybody know what to do?

Thank you very much!

Andreas

Fetch XML: How to retrieve data with multiple linked entities

$
0
0

Hello,

I have three entities; Project, Product and Contact (Default entity).

Project entity can have multiple Products but a product can only belong for one project (1:N relation)

Product can have multiple contacts and a contact can belong to multiple products (N:N relation).

What I'm trying to do is to create a FetchXML query which will return every contact that belong to any products that belong to this particular project. I'm doing this inside a Project form so I know the ProjectId.

But I'm stuck. I'm not really familiar with FetchXML yet. I tried to Google and stuff with no success. Probable this is clear for you so I hope you could help me.

What I have achieved so far is a FetchXML query that will return all contacts that are related to any products. So I'm halfway there I guess. Now I should only add a condition where it would return only the contacts that are related to this project's products right?

Anyway, here is my FetchXML so far

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='contact'>      <attribute name='contactid' /><attribute name='fullname' /><attribute name='jobtitle' /><attribute name='cre_role' /><attribute name='cre_stakeholder' /><attribute name='address1_city' />               <order attribute='fullname' descending='false' />            <link-entity name='cre_contact_cre_product' from='contactid' to='contactid' alias='aa'></link-entity></entity></fetch>

If you wonder the  link-entity name 'cre_contact_cre_product' it's because Product - Contact relationship is N:N and thus I have to use intersect entity (http://msdn.microsoft.com/en-us/library/gg309538.aspx)

So the code above works in a way that it returns every contact in CRM that is related to any product. So how should I continue? I tried almost everything. I guess I have to add one more link-entity inside the current link-entity there...

I tried something like this without success

<link-entity name='cre_project' from='cre_productid' to='cre_productid' alias='bb'><filter type='and'>                <condition attribute='cre_projectid' operator='eq' uiname='Contact' uitype='contact' value='" + projectid + "' />                   </filter></link-entity>

Thank you in advance!



Crmsvcutil and claim based auth failed to autentificate

$
0
0

Hello,

I cannot connect with crmsvcutil to my On premise CRM with claim based auth. It ends with error bellow

Exiting program with exception: The user authentication failed!
Enable tracing and view the trace files for more information.
crmsvcutil.exe Error: 0 : Exiting program with exit code 2 due to exception : System.InvalidOperationException: The user
 authentication failed!
   at Microsoft.Xrm.Sdk.ClientExceptionHelper.Assert(Boolean condition, String message)
   at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.AuthenticateCore()
   at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.ValidateAuthentication()
   at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1.Initialize(ServiceProxy`1 proxy)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceContextInitializer..ctor(OrganizationServiceProxy proxy)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
   at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.RetrieveEntities(IOrganizationService service)
   at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.
LoadMetadata()
   at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
   at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)

 

crmsvcutil /out:entity.cs /url:https://czprgntdv61/ucl/XRMServices/2011/Organization.svc /u:username /d:domain /p:password

When I try to connect from my app to OrgService it works. When I look at fiddler crmsvcutil request ADFS for WSDL but never request endpoint for authentication.

I use SDK 5.0.2

Is there anyone who succcessfully connect to CRM with claim based auth and crmsvcutil?

Thanks

 

CRM 2011: CustomView for regardingobjectid leads to XML error

$
0
0
Hi,

I'm having a problem when creating a new view for the lookup dialog of the field "regardingobjectid" in the entity "serviceappointment" via the jScript method addCustomView(). Selecting another entity type in "Look for" after having displayed the custom view leads to the error "Entity Name specified in FetchXml does not match the entity name in the EntityExpression". When I select another system view in the same entity type as the custom view first, I can switch to the other entity types without any problems.

The jScript code for defining the view in the onLoad of serviceappointment is:

var viewId = "{C5C26189-68CD-4dd9-8619-22CAB0078D12}";var entityName = "test_project";var viewDisplayName = "Test";var fetchXml = "<fetch version='1.0' " +"output-format='xml-platform' " +"mapping='logical'>" +"<entity name='test_project'>" +"<attribute name='test_customerid' />" +"<attribute name='test_matchcode' />" +"<attribute name='test_projectnumber' />" +"<attribute name='test_projectid' />" +"<order attribute='test_customerid' " +"descending='false' />" +"<filter>" +"<condition attribute='test_customerid' " +"operator='eq' " +"value='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' />" +"</filter>" +"</entity>" +"</fetch>";var layoutXml = "<grid name='resultset' " +"object='1' " +"jump='test_projectnumber' " +"select='1' " +"icon='1' " +"preview='1'>" +"<row name='result' " +"id='test_projectid'>" +"<cell name='test_customerid' " +"width='200' />" +"<cell name='test_projectnumber' " +"width='200' />" +"<cell name='test_matchcode' " +"width='100' />" +"</row>" +"</grid>";var lookupControl = Xrm.Page.getControl("regardingobjectid");
    lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, false);

       
What am I doing wrong?

Thanks,

Hendrik

Create webresource

$
0
0

Hi,

Is it possible to create a webresource programmatically using c# or javascript?

If yes then how ?

Thanks,

Kabita

CRM Online Fetch Based Report - Problem With Expressions

$
0
0

Hi,

I'm used to working on a local CRM installation and placing expressions into reports in BIDS.

I'm now working on a CRM online implementation and attempting to use the same query I used in my local version in an expression but I receive the following error:

The Value expression for the text box "Textbox5" refers directly to the field "billto_name" without specifying a dataset aggregate.

The code I used for the expression is as follows:

=IIF(Fields!billto_name.Value, "Dataset1"="","",Fields!billto_name.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_line1.Value, "Dataset1"="","",Fields!billto_line1.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_line2.Value, "Dataset1"="","",Fields!billto_line2.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_line3.Value, "Dataset1"="","",Fields!billto_line3.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_city.Value, "Dataset1"="","",Fields!billto_city.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_stateorprovince.Value, "Dataset1"="","",Fields!billto_stateorprovince.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_postalcode.Value, "Dataset1"="","",Fields!billto_postalcode.Value, "Dataset1" &Chrw(10))&IIF(Fields!billto_country.Value, "Dataset1"="","",Fields!billto_country.Value, "Dataset1" &Chrw(10))

This only started happening after I added an additional dataset and I'm not so sure how to fix it as I've already added the dataset name to each field.

Any help would be appreciated.

Thanks,


James Bratley

Set Customers on Service Activity form with Sdk

$
0
0

Hi All,

Recently I did a plugin to populate some data from a new custom entity into service activity. I managed to populate most of the field except customer field. When debug, there is no errors occur. Just the field do not display anything......

Following is the code in the plugin.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Discovery;


namespace Service_Activity_Plugin
{
    public class ServiceActivity:IPlugin 
    {
        public string subject = "";
        public EntityReference services, customer;
        public static Entity customers;
        public void Execute(IServiceProvider serviceProvider)
        {
            Entity entity;                     

            //Extract the tracing service for use in debugging sandboxed plug-ins.
            ITracingService tracingService =
                (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
                serviceProvider.GetService(typeof(IPluginExecutionContext));

            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            // Check if the input parameters property bag contains a target
            // of the create operation and that target is of type DynamicEntity.
            if (context.InputParameters.Contains("Target") &&
               context.InputParameters["Target"] is Entity)
            {
                // Obtain the target business entity from the input parmameters.
                entity = (Entity)context.InputParameters["Target"];

                // Verify that the entity represents an account.
                if (entity.LogicalName != "serviceappointment") { return; }
            }
            else
            {
                return;
            }

            try
            {                
                Guid equipment,activityid;

                if (context.Stage == 20)
                {
                    if (entity.Contains("new_equipment"))
                    {
                        equipment = ((EntityReference)entity["new_equipment"]).Id;
                        activityid = (Guid)entity["activityid"];

                        //PopulateServActivity(service, equipment,activityid);
                        
                        QueryExpression query = new QueryExpression("new_equipment");
                        ColumnSet cols = new ColumnSet(new string[] { "new_customer", "new_services", "new_name" });

                        ConditionExpression cond = new ConditionExpression("new_equipmentid", ConditionOperator.Equal, equipment.ToString());

                        FilterExpression filter = new FilterExpression(LogicalOperator.And);
                        filter.AddCondition(cond);

                        query.ColumnSet = cols;
                        query.Criteria = filter;

                        RetrieveMultipleResponse resp = RetrieveMultiple(query, service);

                        if (resp.EntityCollection.Entities.Count() > 0)
                        {
                            Entity myEnt = resp.EntityCollection.Entities[0];

                            subject = myEnt["new_name"].ToString();

                            services = (EntityReference)myEnt["new_services"];
                            customer = (EntityReference)myEnt["new_customer"];

                            customers = new Entity("activityparty");
                            customers["partyid"] = new EntityReference("account", new Guid(customer.Id.ToString()));                            

                        }
                        
                        entity.Attributes.Add("customers",new Entity[] {customers});
                        entity.Attributes.Add("serviceid", services);
                        entity.Attributes.Add("subject", subject);
                        entity.Attributes.Add("regardingobjectid", new EntityReference("new_equipment",equipment));
                        entity.Attributes.Add("regardingobjectidname", ((EntityReference)entity["new_equipment"]).Name);
                    }
                    else
                    {
                        throw new Exception("Equipment cannot blank.");
                    }
                }
            }
            catch (FaultException<OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);
            }

            catch (Exception ex)
            {
                tracingService.Trace("ContactImportPlugin: {0}", ex.ToString());
                throw;
            }
        }
        private static RetrieveMultipleResponse RetrieveMultiple(QueryExpression query, IOrganizationService crmService)
        {
            RetrieveMultipleRequest rm = new RetrieveMultipleRequest();
            rm.Query = query;
            return crmService.Execute(rm) as RetrieveMultipleResponse;
        }

    }
}

Any help is much appreciated.

Thanks.

Regards,
Teh

Viewing all 1000 articles
Browse latest View live


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