Quantcast
Channel: CRM Development forum
Viewing all 465 articles
Browse latest View live

CRM 2011 accessing webcontext with outlook plugin

$
0
0

Hi,

I have found some plugin code on the web that enables me to get the entity ID and the object type code for an entity in a plugin.  The plugin is fired on RetrieveMultiple on activitypointer. The code lets me get the id and object code of the entity that is currently being viewed (which is displaying the activities grid which is firing the plugin).

This code works fine when using the web interface.  However I need it to also work in the Outlook preview pane and currently it does not.  The activities grid in the Outlook preview pane just says "an error has occurred".  Below is the code that the plugin is using to get the details from the web header.

        internal static Dictionary<string, string> GetHeaderFields(HttpContext webcontext, string objectTypeCode, string objectId)
        {
            Dictionary<string, string> fields = new Dictionary<string, string>();
            string callerentitytype = null;
            string callerentityidstring = null;
            try
            {
                // Activities Navigation Pane
                if (new List<string>(webcontext.Request.Params.AllKeys).Contains("oType"))
                {
                    callerentitytype = webcontext.Request.Params["oType"];
                    callerentityidstring = webcontext.Request.Params["oId"];
                }
                // Activities Sub Grid
                else
                {
                    string requeststring = webcontext.Request.UrlReferrer.Query;
                    requeststring = requeststring.Substring(1);

                    string[] parts = requeststring.Split(new string[] { "=", "&" }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < parts.Length - 1; i++)
                        if (parts[i].ToLower() == "otype" || parts[i].ToLower() == "etc")
                            callerentitytype = parts[i + 1];
                        else if (parts[i].ToLower() == "oid" || parts[i].ToLower() == "id")
                            callerentityidstring = parts[i + 1];
                }

                fields.Add(objectTypeCode, callerentitytype);
                fields.Add(objectId, callerentityidstring);
            }
            catch (Exception ex)
            {
                throw new Plugin.LoggableException(string.Format("Failed to obtain header information; {0}", ex.Message), ex.InnerException);
            }

            return fields;
        }

I'm guessing this is because the web browser is not being used. I need to be able to get this information for when the user is viewing through the Outlook plugin preview pane. Is this possible?

EDIT:  The reason is that webcontext.Request.UrlReferrer is NULL. Is there anywhere else I can get this info of the 'calling' entity?  (Not the activity sub grid that is triggering the plugin, but the actual parent entity).

Thanks for any help or direction with this.





CRM 2013: 2 level flyout menus

$
0
0

Hello,

We are been using MSCRM 2011 for a number of years and have customised the Ribbon to include a 2 level flyout menu.  i.e.

> Reports                                         <-- This is the 1st level Flyout
    - Report 1
    - Report 2
    - Report 3
    > Other Team Reports                     <-- This is a 2nd level Flyout
           - Report 4
           - Report 5
     > Other Entity Reports                    <-- This is a 2nd level Flyout
           - Report 6
           - Report 7

This worked perfectly in that you would have a FlyoutAnchor in the RibbonDiff XML and then when it called the PopulateQueryCommand function in our JScript we'd provide another FlyoutAnchor (when the user hovered over).  Then when the user hovered over the 2nd level FlyoutAnchor we'd load the menu items.

We made it dynamically load 2 levels because we didn't want to cause a large hit to return the records which were occasionally used, but still needed (we've done a bit of work to make the reports scope to the users)

We have migrated to MSCRM 2013 (SP1 RU1) and found some change in behaviour :-

1. FlyoutAnchor 2nd Level doesn't work.  When you hover over the menu it reports 'No actions available'.  The code to load the menu items doesn't fire.

   - We have worked around this by loading the <Menu> items directly in the first PopulateQueryCommand JScript.  Not ideal, but it works

2. 2nd level menu items available but unclickable after the first load - With the 2nd level Flyout menu items we have experienced weird behaviour.  The first view of the menu items are clickable, but for subsequent views they are not. 

   - After a bit of playing, and mucking around I found that if the Flyout Id for the 2nd level has a random number in it then it doesn't experience the issue.  Think there is some odd caching occurring - even with CacheMenuVersions = False.

The whole thing is odd, because it did work perfectly in CRM 2011.  Anyone got 2nd level flyouts to work in CRM 2013?

Below is the 2nd level Flyout JScript code snippet.

" <FlyoutAnchor Id=\"RASV.Report.Flyout.RunBatchReportOtherEntities." + Math.floor((Math.random() * 1000000) + 1) + "\" " +" PopulateQueryCommand=\"RASV.Report.RunBatchReport.PopulateMenuSSRSOtherEntities." + screenType + "\" " +" CacheMenuVersions=\"false\" " +" PopulateDynamically=\"true\" " +" PopulateOnlyOnce=\"false\" " +" LabelText=\"In Other Entities ...\" " +" Command=\"Mscrm.ReportMenu.Grid\" " +" ToolTipTitle=\"More Reports\" " +" ToolTipDescription=\"List reports used by other teams.\" " +" Sequence=\"1010\" > " +
			                                menuItemXML +" </FlyoutAnchor> ";       

AddUserToRecordTeamRequest returns error: An object with the specified name already exists

$
0
0

MS-CRM 2013, SP1, UR1, on premisses

We have a plug-in which maintains access using access teams. In general it works as intended, except when (another plugin/program/whatever) fires a number of requests against the same record instance.

Scenario:

an account exists with no access team created
give 5 users access to the account using AddUserToRecordTeamRequest
since all/most of the requests are executed in parallel, request no 2-5 do not recognize that the access team has been created
error An object with the specified name already exists is returned

public static void AddUserToTeam(IOrganizationService service, Guid UserId, Guid teamTemplateId, EntityReference entityToAdd)
{
    // Add user to system generated access team

    try
    {
        if (!UserIsActive(service, UserId)) { return; }
        if (UserIsTeamMember(service, UserId, teamTemplateId, entityToAdd.Id)) { return; }

        AddUserToRecordTeamRequest adduser = new AddUserToRecordTeamRequest()
        {
            Record = entityToAdd,
            SystemUserId = UserId,
            TeamTemplateId = teamTemplateId
        };
        AddUserToRecordTeamResponse response = (AddUserToRecordTeamResponse)service.Execute(adduser);
    }
    catch (Exception ex)
    {
        throw new InvalidPluginExecutionException("An error occurred ...", ex);
    }
}

I started a full trace an can see that the system tries to create multiple team records with the same name:

>System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.TeamBase' with unique index 'ndx_TeamName_BusinessUnitId'. The duplicate key value is (6b858c7e-297c-e211-9ac5-00219b2eb12d+ffc40c85-917c-e311-bca4-005056936680, e71926ab-8955-e211-b743-00505693003b).


Per



CRM 2013 - Javascript - Can I stop my Javascript code running if a certain condition is met?

$
0
0

Hi, I've created a piece of JavaScript that runs when a account name is inputted by the customer, from the account name a account code is generated. Once the account code has been saved I do not want the account code to be edited again, but the account name can be. My problem is even when account code is set to read only my JavaScript will kick in and change the account code

I was wondering if there was a way of using the OnLoad event the programme could check if a Account code is present, if it is then my piece of javascript will be disabled?

Thanks, Shaun


S.Harrison

Sandbox plugins not working CRM 2011 UR 17

$
0
0

Hi,

I have updated a CRM 2011 to UR 17. Know I am running
in to troubles with sandbox plugins. Before I go into details a brief summary
about the system environment:

  • Development-Server -> A “Test”-system runs for development purposes
  • Customer-Server -> a “test”-system and a “productive”-system run on the same machine

Currently I only have troubles with the test-System on
the customer-machine: No plugin, which will be registered in Sandbox mode will
be successfully executed end ends up with an unexpected error. In the
Plugin-Trace you can not even see any custom tracing infos, which I added to my
custom code.

Below you can see the Trace output und the traces from
the Crm-Diagnostic-Tools. Where I begin to wonder is the part with “>NestingDepth:
300”.

One temporary solution for me is that I have set all Plugins
to Isolation-Mode “None”. Does anyone have an idea what problem could be?

Many thanks in advance

Klemens

Plugin-Trace:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #56B43D1ADetail:<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"><ErrorCode>-2147220970</ErrorCode><ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /><Message>System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #56B43D1A</Message><Timestamp>2014-11-06T07:22:42.6051352Z</Timestamp><InnerFault i:nil="true" /><TraceText>

[ITPRO.CRM.OOEBS.Plugins: MS_CRM_2011_Auto_Number.AutoNumber]
[1349db3a-125f-e211-994f-000c29b38ce1: MS_CRM_2011_Auto_Number.AutoNumber: Create of itpro_reception]


</TraceText></OrganizationServiceFault>

CrmDiagnisticTool-Trace:

[2014-11-06 08:09:31.504] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | ExceptionConverter.TryConvertToCrmExceptionInternal  ilOffset = 0x2B
 at ExceptionConverter.TryConvertToCrmExceptionInternal(Exception exception, CrmException& crmException)  ilOffset = 0x2B
 at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException)  ilOffset = 0xAE
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x18F
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
 at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xB4
 at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x4E
 at RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)  ilOffset = 0xFFFFFFFF
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  ilOffset = 0x101
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x0
 at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
 at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
 at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>TryConvertToCrmExceptionInternal: top level exception is CrmException
[2014-11-06 08:09:31.504] Process: w3wp |Organization:8a49e62d-f164-e411-9cdd-005056be6b80 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Error |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | MessageProcessor.Execute  ilOffset = 0x18F
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x18F
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
 at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xB4
 at BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x4E
 at RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)  ilOffset = 0xFFFFFFFF
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  ilOffset = 0x101
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x0
 at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
 at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
 at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x50
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>MessageProcessor fail to process message 'Create' for '<ourCustomEntiy>'.
[2014-11-06 08:09:31.520] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | ExceptionConverter.IsSandboxException  ilOffset = 0x3F
 at ExceptionConverter.IsSandboxException(Exception exception)  ilOffset = 0x3F
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>IsSandboxException: TargetInvocationException
[2014-11-06 08:09:31.520] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | ExceptionConverter.IsSandboxException  ilOffset = 0x8B
 at ExceptionConverter.IsSandboxException(Exception exception)  ilOffset = 0x8B
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>IsSandboxException: true
[2014-11-06 08:09:31.520] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>enter: TryConvertToCrmException: exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
[2014-11-06 08:09:31.520] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | ExceptionConverter.DumpExceptionRecursive  ilOffset = 0x27C
 at ExceptionConverter.DumpExceptionRecursive(StreamWriter streamWriter, Exception exception)  ilOffset = 0x27C
 at ExceptionConverter.DumpExceptionToString(Exception exception, String info)  ilOffset = 0x26
 at ExceptionConverter.DumpExceptionToTrace(Exception exception, String info)  ilOffset = 0x8
 at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException)  ilOffset = 0x57
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>NestingDepth: 300
[2014-11-06 08:09:31.520] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   34 |Category: Platform |User: 9341f658-50fd-4f40-b56f-b90a86227a8d |Level: Info |ReqId: 4adf08a8-b965-4f48-8823-84d06dc4d5bc | ExceptionConverter.DumpExceptionToTrace  ilOffset = 0x11
 at ExceptionConverter.DumpExceptionToTrace(Exception exception, String info)  ilOffset = 0x11
 at ExceptionConverter.TryConvertToCrmException(Exception exception, CrmException& crmException)  ilOffset = 0x57
 at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
 at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
 at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145
 at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x34
 at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
 at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
 at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
 at CreateCommand.Execute()  ilOffset = 0xC
 at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId)  ilOffset = 0x0
 at EntityProxy.Create(Boolean performDuplicateCheck)  ilOffset = 0x0
 at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)  ilOffset = 0x28
 at AppForm.Save(Boolean& gridRefreshCallbackAdded)  ilOffset = 0x47
 at AppForm.FormSaveEvent()  ilOffset = 0xD
 at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xCF
 at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
 at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
 at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
 at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
 at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x53
 at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x69E
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
 at Page.ProcessRequest()  ilOffset = 0x14
 at Page.ProcessRequest(HttpContext context)  ilOffset = 0x31
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x11D
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
 at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10E
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0xFC
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x45
>----- dump exception/fault tree (TryConvertToCrmException: before) -----
>>>>>> EXCEPTION: 0
>Type: System.Reflection.TargetInvocationException
>Message (57): Exception has been thrown by the target of an invocation.
>StackTrace: present: 40761152
>no PluginTrace
>>>>>> EXCEPTION: 1
>Type: Microsoft.Crm.CrmException
>ErrorCode: 0x80040216: ErrorCodes.UnExpected
>Message (181): System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0330D39D
>StackTrace: present: C71C5945
>PluginTrace length: 166
>>>>>> PluginTrace (166):
>[<ourPluginNamespace>: MS_CRM_2011_Auto_Number.AutoNumber]
>[1349db3a-125f-e211-994f-000c29b38ce1: MS_CRM_2011_Auto_Number.AutoNumber: Create of <ourCustomEntiy>]
>
><<<<< PluginTrace:
>>>>>> FAULT: 0
>ErrorCode: 0x80040216: ErrorCodes.UnExpected
>Message (181): System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0330D39D
>Timestamp: present
>TraceText <null>
>CallStack <null>
>InnerFault <null>
><<<<< FAULT: 0
>InnerException <null>
><<<<< EXCEPTION: 1



Error when using aliased value in FetchXML query in silverlight

$
0
0

Hello Everyone,

I am trying to make a fetchXML query from my Silverlight app. 

This is the query I am using:

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='promx_project'><attribute name='promx_projectname' /><attribute name='statuscode' /><attribute name='promx_projecttypelookup' /><attribute name='promx_baseprojectlookup' /><attribute name='promx_accountlookup' /><attribute name='promx_type' /><attribute name='promx_defaultactivityrecordtypeid' /><attribute name='promx_timeunitlookup' /><link-entity name='promx_project' from='promx_projectid' to='promx_baseprojectlookup' alias='baseproject' link-type='outer'><attribute name='promx_projectname' /></link-entity><filter type='or'><condition attribute='promx_projectname' operator='like' value='%{0}%' /><filter type='and'><condition entityname='baseproject' attribute='promx_projectname' operator='not-null' /><condition entityname='baseproject' attribute='promx_projectname' operator='like' value='%{0}%' /></filter></filter></entity></fetch>

It is working fine with fetchXML tester, but it gives the following error when I debug in silverlight:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:RetrieveMultipleResult. The InnerException message was 'Error in line 1 position 3743. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value' contains data of the 'http://schemas.microsoft.com/xrm/2011/Contracts:AliasedValue' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to 'AliasedValue' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.

Other queries work fine, just this one fails, I guess because it is using an alias. I tried to manually add a KnownTypeAttribute to the Reference.cs, but I am not sure where to insert it.

Any ideas?

Regards,

Adam

Updating a lookup field plugin

$
0
0

Hi,

This plugin is to update a lookup field on Merge message and pre-operation. Nothing is happening when cases are merged using merge button. Can someone please take a look at my code. Thank you.

 protected void ExecutePreCallsMerge(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            // TODO: Implement your custom Plug-in business logic.

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService service = localContext.OrganizationService;

            // 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
                {
                    Guid subordinateId = (Guid)context.InputParameters["SubordinateId"];

                    var fetch = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='activity'><attribute name='new_status' /><filter type='and'><filter type='and'><condition attribute='regardingobjectid' operator='eq' uitype='incident' value='" + subordinateId + @"' /><condition attribute='statecode' operator='eq' value='0' /></filter></filter></entity></fetch>";

                    EntityCollection ec = service.RetrieveMultiple(new FetchExpression(fetch));
                    if (ec.Entities.Count > 0)
                    {
                        // Create an ExecuteMultipleRequest object.
                        ExecuteMultipleRequest multipleRequest = new ExecuteMultipleRequest()
                        {
                            // Assign settings that define execution behavior: continue on error, return responses.
                            Settings = new ExecuteMultipleSettings()
                            {
                                ContinueOnError = false,
                                ReturnResponses = true
                            },
                            // Create an empty organization request collection.
                            Requests = new OrganizationRequestCollection()
                        };

                        foreach (var item in ec.Entities)
                        {
                            item.Attributes["new_status"] = "Closed";
                            UpdateRequest updateRequest = new UpdateRequest { Target = item };
                            multipleRequest.Requests.Add(updateRequest);
                        }

                        // Execute all the requests in the request collection using a single web method call.
                        ExecuteMultipleResponse multipleResponse = (ExecuteMultipleResponse)service.Execute(multipleRequest);
                    }
                }
                catch (Exception Ex)
                {
                    throw new InvalidPluginExecutionException(Ex.ToString());
                }
            }

        }

Error Registering Plugin in "None" isolation Mode

$
0
0

Hello,

We are on CRM 2013 On-Premise. We migrated from CRM 2011 Online version, then to On-Premise version. Then finally upgraded to 2013 version.

Coming from CRM Online version, our plugins have always been registered under the "Sandbox" mode.

After in 2013 On-Premise version now, we have a project that connects to a WCF service, and we don't seem to get it working in the Sandbox mode because it does not allow partial trust connection.

However I never have a success registering the plugin in a "None" isolation mode with below error message:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Action failed for assembly 'My.Plugins, Version=1.0.0.1, Culture=neutral, PublicKeyToken=71924faff9160a40': Assembly must be registered in isolation.

Exception rethrown at [0]:
   at Microsoft.Crm.Tools.Libraries.RegistrationHelper.UpdateAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly, PluginType[] type)
   at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.btnregisterClick()


Searching the solution out there, actually I am already a CRM Deployment Administrator and I confirmed by successfully created a new CRM organization.

Any ideas? Thanks in advance for your help, appreciate it.

-tri



how to unshare the shared record using plugin dynamics crm 2013

$
0
0

i did share a record to another user using plugin.but the same record unsharing using plugin. but its not getting me.below is my code.the record is still exists in that user.

 if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"]) is Entity)
            {
                Entity en = (Entity)context.InputParameters["Target"];
                RevokeAccessRequest revokeaccess = new RevokeAccessRequest();
                revokeaccess.Target = new EntityReference(en.LogicalName,en.Id);
                Guid id = new Guid("C059255F-5930-4DD2-A2B9-61273359C123");
                revokeaccess.Revokee = new EntityReference("systemuser",id);
                RevokeAccessResponse revokeresponse = (RevokeAccessResponse)service.Execute(revokeaccess);
            }

where i'm doing wrong.


hsk srinivas

CRM2013: Can't write to E-mail description field with javascript

$
0
0

What am I doing wrong here?

Scenario: When creating a new e-mail I want to automatically add an e-mail signature to the e-mail description field. The e-mail signature comes from a text field on the user form. So I am trying to make a javascript that activates OnLoad on E-mail form:

  1. First it checks for Formstate = Create,
  2. then it fetches the e-mail signature tekst from the current user and
  3. pastes the text into the description field on the e-mail.

I can get 1 and 2 to work, but no 3 is not working. Can you see what I am doing wrong?

I have attached my javascript here:

function fetchAutoSig()
{
var formType = Xrm.Page.ui.getFormType();
//alert(formType);

if (formType == 1) {
		var Email = getCurrentUserEmail();
		//alert(Email);
		Xrm.Page.getAttribute("description").setValue(Email.toString());
		Xrm.Page.getAttribute("description").setSubmitMode("always");
}
}

function getCurrentUserEmail() {

    var serverUrl;

    if (Xrm.Page.context.getClientUrl !== undefined) {

        serverUrl = Xrm.Page.context.getClientUrl();

    } else {

        serverUrl = Xrm.Page.context.getServerUrl();

    }

    var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";

    var userRequest = new XMLHttpRequest();

    userRequest.open("GET", ODataPath + "/SystemUserSet(guid'" + Xrm.Page.context.getUserId() + "')", false);

    userRequest.setRequestHeader("Accept", "application/json");

    userRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    userRequest.send();

    if (userRequest.status === 200) {

        var retrievedUser = JSON.parse(userRequest.responseText).d;

        var userEmail = retrievedUser.val_Emailsignatur;

        return userEmail;

    }

    else {

        return "error";

    }

}

how to unshare the shared record using plugin dynamics crm 2013

$
0
0

i did share a record to another user using plugin.but the same record unsharing using plugin. but its not getting me.below is my code.the record is still exists in that user.

 if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"]) is Entity)
            {
                Entity en = (Entity)context.InputParameters["Target"];
                RevokeAccessRequest revokeaccess = new RevokeAccessRequest();
                revokeaccess.Target = new EntityReference(en.LogicalName,en.Id);
                Guid id = new Guid("C059255F-5930-4DD2-A2B9-61273359C123");
                revokeaccess.Revokee = new EntityReference("systemuser",id);
                RevokeAccessResponse revokeresponse = (RevokeAccessResponse)service.Execute(revokeaccess);
            }

where i'm doing wrong.


hsk srinivas

ActivityParty won't set on Online

$
0
0

Hi!

I'm trying to migrate data from MS Dynamics CRM On Premise 2011 (5.0) to Online (Spring '14).

At this point I'm stuck with the Activity-entities. I can get the entities to Online, but the ActivityParty won't get along, the 'From', 'To', 'Cc' etc. fields are empty. I map the whole entity, for example 'Email', in my tool, but when I create it with the OrganizationService, it won't get to Online.

    public class EmailBuilder : BuilderBase
    {
        private Email result;
        private ActivityPointerBase emailBase;

        public EmailBuilder(OrganizationServiceProxy proxy, CRMContainer dataContext, AccountContext accountContext, ActivityPointerBase emailBase, Guid ownerID)
            : base(dataContext, accountContext)
        {
            this.result = new Email();
            this.result.OwnerId = this.BuildOwnerId(ownerID);
            this.emailBase = emailBase;
        }


        public override Microsoft.Xrm.Sdk.Entity GetResult()
        {
            return result;
        }

        public override void Build()
        {
            this.result.ActivityId = emailBase.ActivityId;
            this.result.ActualEnd = emailBase.ActualEnd;
            this.result.ActualStart = emailBase.ActualStart;

            List<ActivityPartyBase> activityParties = new List<ActivityPartyBase>();

            activityParties = partyRepository.GetActivityPartiesById(emailBase.ActivityId);

            //Activity.From is mapped here
            //IEnumerable<ActivityPartyBase> activitypartybasesFrom = new List<ActivityPartyBase>();
            //activitypartybasesFrom = activityParties.Where(x => x.ParticipationTypeMask == (int)ParticipationTypeMask.SenderFrom);
            //if (activitypartybasesFrom != null)
            //{
            //    List<ActivityParty> fromparties = new List<ActivityParty>();

            //    foreach (ActivityPartyBase item in activitypartybasesFrom)
            //    {
            //        ActivityParty activityParty = new ActivityParty
            //        {
            //            PartyId = new EntityReference(SystemUser.EntityLogicalName, emailBase.OwnerId)
            //        };
            //        activityParty.ActivityId = new EntityReference(ActivityParty.EntityLogicalName, item.ActivityId);
            //        activityParty.ActivityPartyId = item.ActivityPartyId;
            //        activityParty.AddressUsed = item.AddressUsed;

            //        activityParty.ParticipationTypeMask = new OptionSetValue(item.ParticipationTypeMask);
            //        if (item.PartyId.HasValue)
            //        {
            //            activityParty.PartyId = new EntityReference(ActivityParty.EntityLogicalName, item.PartyId.Value);
            //        }
            //            fromparties.Add(activityParty);
            //    }

            //        //this.result.From = fromparties;
            //}
            //

            //Activity.To is mapped here
            IEnumerable<ActivityPartyBase> activitypartybasesTo = new List<ActivityPartyBase>();
            activitypartybasesTo = activityParties.Where(x => x.ParticipationTypeMask == (int)ParticipationTypeMask.ToRecipient);
            if (activitypartybasesTo != null)
            {
                List<ActivityParty> toparties = new List<ActivityParty>();

                foreach (ActivityPartyBase item in activitypartybasesTo)
                {
                    ActivityParty activityParty = new ActivityParty();
                    activityParty.ActivityId = new EntityReference(ActivityParty.EntityLogicalName, item.ActivityId);
                    activityParty.ActivityPartyId = item.ActivityPartyId;
                    activityParty.AddressUsed = item.AddressUsed;
                    activityParty.ParticipationTypeMask = new OptionSetValue(item.ParticipationTypeMask);
                    activityParty.LogicalName = "activityparty";
                    activityParty.Id = new Guid();
                    activityParty.ActivityPartyResourceSpec = new ResourceSpec();
                    if (item.PartyId != null)
                    {
                        activityParty.PartyId = new EntityReference(ActivityParty.EntityLogicalName, (item.PartyId).GetValueOrDefault());
                    }


                    toparties.Add(activityParty);
                }
                this.result.To = toparties;
            }
            //

            //Activity.Cc is mapped here
            IEnumerable<ActivityPartyBase> activitypartybaseCcRecipients = new List<ActivityPartyBase>();
            ActivityPartyBase partyBase = new ActivityPartyBase();
            partyBase = activityParties.First(x => x.ParticipationTypeMask == (int)ParticipationTypeMask.SenderFrom);

            ActivityParty activityParty1 = new ActivityParty();
            activityParty1.ActivityId = new EntityReference(ActivityParty.EntityLogicalName, partyBase.ActivityId);
            activityParty1.ActivityPartyId = partyBase.ActivityPartyId;
            activityParty1.AddressUsed = partyBase.AddressUsed;
            activityParty1.ParticipationTypeMask = new OptionSetValue(partyBase.ParticipationTypeMask);
           }


                //this.result.From = new ActivityParty[] { activityParty1 };
            //this.result.email_activity_parties = ccparties;


            //Activity.Bcc is mapped here
            IEnumerable<ActivityPartyBase> activitypartybaseBccRecipients = new List<ActivityPartyBase>();
            activitypartybaseBccRecipients = activityParties.Where(x => x.ParticipationTypeMask == (int)ParticipationTypeMask.BccRecipient);

            List<ActivityParty> bccparties = new List<ActivityParty>();
            foreach (ActivityPartyBase item in activitypartybaseBccRecipients)
            {
                ActivityParty activityParty = new ActivityParty
                {
                    PartyId = new EntityReference( SystemUser.EntityLogicalName, emailBase.OwnerId)
                };
                activityParty.ActivityId = new EntityReference(ActivityParty.EntityLogicalName, item.ActivityId);
                activityParty.ActivityPartyId = item.ActivityPartyId;
                activityParty.AddressUsed = item.AddressUsed;
                activityParty.ParticipationTypeMask = new OptionSetValue(item.ParticipationTypeMask);
                //if (item.PartyId != null)
                //{
                //    activityParty.PartyId = new EntityReference(ActivityParty.EntityLogicalName, (item.PartyId).GetValueOrDefault());
                //}

                bccparties.Add(activityParty);
            }
            this.result.Bcc = bccparties;
            //

////Mapping of loose attributes here////

        }

I commented the other party-mappings out, just to check if a single mapping will do. When I debug it's working: the ActivityParty will set in the Email.

Here where I retrieve it in my Builder:

public override void Process(OrganizationServiceProxy proxy, CRMContainer dataContext, AccountContext accountContext)
        {
            List<ActivityPointerBase> emailBases = new List<ActivityPointerBase>();
            emailBases = emailRepository.FetchAll((int)ActivityPointerType.Email);

            foreach (ActivityPointerBase emailBase in emailBases.Take(2))
            {
            EmailBuilder emailBuilder = new EmailBuilder(proxy, dataContext, accountContext, emailBase, ownerID);
            emailBuilder.Build();
            Email email = (Email)emailBuilder.GetResult();
            email.Id = proxy.Create(email);
            accountContext.emails.Add(email);
            }
}

Have any of you guys an idea of what I'm doing wrong? Any tips?

Thanks in advance!!

MSCRM 2013 Retreive Post Text

$
0
0

I have a requirement where I have to retrieve Post entity record's text and use the string retrieved.The Post.Text attribute value comes in the below format :

<?xml version="1.0" encoding="utf-16" ?>
- <pi id="CaseAssign.Post" icon="0">
- <ps><p type="1" otc="112" id="44b53e40-a775-e411-80c1-000c2908bc67">2014-0222265</p><p type="1" otc="8" id="5a5661ed-6763-e411-80be-000c2908bc67">ABCD</p><p type="1" otc="8" id="8d131321-6863-e411-80be-000c2908bc67">EFGH</p></ps></pi>

The actual text should be as follows which is shown in the Post wall "2014-0222265 was assigned to ABCD by EFGH". Parsing XML to string is also of no help.Any guesses as to how this can be done? The issue occurs for Post records of Source Auto and not manual since manual posts do not have the text in XML format.Any help on this?

Filtered lookup field default view issue CRM 2011

$
0
0

Hi everyone,

i'm exepriencing a strange issue tempting to filter a lookup dialog in Connection system entity.
In substance i created a Jscript that is fired on "Name" field OnChange event: if the chosen entity type is "systemuser" the Jscript adds to the lookup field "As this role" a custom view filtered only on my roles with success. Adding the view i set it as default but, inexplicably, the default view is not changed (compared to usual) and i can visualize all system connection roles.

I also tried to disable programmatically the view picker, again without success.

Here is my code:

function OnDestinationChange() {
    var connectionDestinationType = Xrm.Page.getAttribute("record2id").getValue()[0].entityType;

    if (connectionDestinationType == "systemuser") {
        var defaultLookupViewId = "{108E1BE5-BE0B-4B9F-9827-80841CDD5F48}";

        var viewId = "{B21D26A7-6E68-4775-A425-CC045E832E7F}";
        var entityName = "connectionrole";
        var displayName = "Ruoli di connessione filtrati";

        var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +"<entity name='connectionrole'>" +"<attribute name='category' />" +"<attribute name='name' />" +"<attribute name='connectionroleid' />" +"<attribute name='statecode' />" +"<order attribute='category' descending='false' />" +"<filter type='and'>" +"<condition attribute='name' operator='eq' value='Parte Interessata' />" +"</filter>" +"</entity>" +"</fetch>";

        var layoutXml = "<grid name='resultset' object='1' jump='connectionroleid' select='1' icon='1' preview='1'>" +"<row name='result' id='connectionroleid'>" +"<cell name='name' width='200' />" +"<cell name='category' width='200'/>" +"</row>" +"</grid>";

        Xrm.Page.getControl("record2roleid").addCustomView(viewId, entityName, displayName, fetchXml, layoutXml, true);
        document.getElementById("record2roleid").disableViewPicker = 1;
    }
    else {
        document.getElementById("record2roleid").disableViewPicker = 0;
        Xrm.Page.getControl("record2roleid").setDefaultView(defaultLookupViewId);
    }
}
Can someone help me?

Thanks in advance.



CRM 2011: Why does a CRM form fire the document.ready event twice when it opens?

$
0
0

Why does CRM fire off the document.ready twice when a form loads?

If you put the following code in a JavaScript class that is used for form customizations, it will always fire twice. I have ran into issues with this before but never noticed exactly what was happening until now.

It is after the second document.ready event that the display and enable rules are applied. However, between the two document.ready events, the soon to be disabled or hidden buttons are active and availalbe for a user to click on them. So I've added jQuery to disable them during the first event, so they are not clickable until the second event has a chance to set them.

I'm just curious if there is a reason for the event to fire off twice like this.

$(document).ready(function () {
    alert("document ready");
});


Jon Gregory Rothlander



Entity Id must be specified error when calling dialog

$
0
0

I have a custom ribbon button on the Opportunity form that calls a custom dialog. The dialog it calls creates a phone call with the Regarding set to an Opportunity - it gets the opportunity id from the URL. It then calls a child dialog and passes the opportunity details into that child dialog along with the Phone Call as the topic. This child dialog updates the opportunity and closes the call created in the parent dialog. This works fine when I call the URL directly, and when I click on the custom ribbon button in CRM to call the parent dialog, that also works and I see everything being updated as it should be. The URL definiely works, that has all been tested multiple times. When accessing it directly, or from the report while actually on the report server - it works every time.

The users are viewing reports via 3rd party software in a web browser tab. When the report is viewed here, the user can click on a URL to open the opportunity in CRM (opens in a new tab). Once the opportunity is open, the user can then click on the custom ribbon button that calls the parent dialog, they get a message asking "Do you want to leave this page?". (the dialog opens in a new window). They click yes, then get an error saying "Inavlid Argument". I've checked the logs and this is what's coming up:

[2014-12-04 16:56:39.246] Process: w3wp |Organization:6ea476f3-6c49-e411-bda1-0050568e76b7 |Thread:   59 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 13b1c571-fb5a-4f74-9559-197aea53de80 | ErrorInformation.LogError  ilOffset = 0x17>MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: Entity Id must be specified for Update
Error Number: 0x80040203
Error Message: Entity Id must be specified for Update
Error Details: Entity Id must be specified for Update
Source File: Not available
Line Number: Not available
Request URL: https://crmuatintr.acornlife.ie/AcornGIUAT/AppWebServices/InteractiveWorkflowWebService.asmx
Stack Trace Info: [CrmException: Entity Id must be specified for Update]
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.UpdateCommand.Execute()
   at Microsoft.Crm.Application.WebServices.InteractiveWorkflowWebService.UpdateSession(String sessionId, String comments)
[2014-12-04 16:56:46.469] Process: w3wp |Organization:6ea476f3-6c49-e411-bda1-0050568e76b7 |Thread:   64 |Category: Platform.Workflow |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 7180dcbd-457b-4054-9a28-006c38a038bd | UnhandledExceptionEventHandler.OnStage1Complete  ilOffset = 0x46>Workflow terminated: {3D6BEF6D-0EAF-4D4A-9BBC-2237E556C08D} - Microsoft.Crm.Workflow.Activities.StopWorkflowException: Jumping to Child Interactive Workflow.
   at Microsoft.Crm.Workflow.Services.ChildInteractiveWorkflowActivityService.StartChildInteractiveWorkflowInternal(String entityName, Guid entityId, Guid workflowDefinitionId, Dictionary`2 inputArguments)
   at Microsoft.Crm.Workflow.Services.ChildInteractiveWorkflowActivityService.ExecuteInternal(CodeActivityContext executionContext, StartChildInteractiveWorkflow startChildInteractiveWorkflow)
   at Microsoft.Crm.Workflow.Services.ChildInteractiveWorkflowActivityService.Execute(CodeActivityContext executionContext, StartChildInteractiveWorkflow startChildInteractiveWorkflow)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation), WorkflowInstanceId: {C3DFD084-D67B-E411-9F8E-0050568E76B7}

Here's the code behind the custom ribbon button, that runs the dialog. I put in alerts for the dialogId, primaryEntityId (both GUIDs) and objectTypeCode (which was 'opportunity') and they all looked like valid values.

(function() {
Develop1_RibbonCommands_runDialogGrid = function(ids, objectTypeCode, dialogId) {
    if ((ids == null) || (!ids.length)) {
        alert(window.LOCID_ACTION_NOITEMSELECTED);
        return;
    }
    if (ids.length > 1) {
        alert(window.LOCID_GRID_TOO_MANY_RECORDS_IWF);
        return;
    }
    var rundialog = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');
    rundialog.get_query()['DialogId'] = dialogId;
    rundialog.get_query()['ObjectId'] = ids[0];
    rundialog.get_query()['EntityName'] = objectTypeCode;
    openStdWin(rundialog,buildWinName(null),615,480,null);
}
Develop1_RibbonCommands_runDialogForm = function(objectTypeCode, dialogId) {
    var primaryEntityId = Xrm.Page.data.entity.getId();
    var rundialog = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');
    rundialog.get_query()['DialogId'] = dialogId;
    rundialog.get_query()['ObjectId'] = primaryEntityId;
    rundialog.get_query()['EntityName'] = objectTypeCode;
    openStdWin(rundialog,buildWinName(null),615,480,null);
}
})();

UPdate Plugin Pre Operation

$
0
0

Hi,

I am trying to write a plugin on my own. I am fairly new to crm.

This plugin is to update a lookup field before the record status reason changes. So I registered it on Update message Pre Operation event. But I don't think it is doing anything it has to do! Here is my code, please let me know the mistakes I've done and I will be happy to learn from my mistakes. Thanks

protected void ExecutePreTaskUpdate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            // TODO: Implement your custom Plug-in business logic.
            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService service = localContext.OrganizationService;

            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {

                //create entity context
                Entity entity = (Entity)context.InputParameters["Target"];

                if (entity.LogicalName != "task")

                    return;

                try
                {
                    if (entity.Contains("new_taskissuephase"))
                    {
                        OptionSetValue taskStateCode = entity.GetAttributeValue<OptionSetValue>("statecode");

                        QueryExpression query = new QueryExpression
                        {
                            EntityName = "new_taskissuephase",
                            Criteria =
                            {
                                Conditions =
                                {
                                    new ConditionExpression("new_taskissuephase",ConditionOperator.Equal,"Tech Work Complete")
                                }
                            }
                        };

                        EntityCollection resultsCollection = localContext.OrganizationService.RetrieveMultiple(query);
                        foreach (Entity result in resultsCollection.Entities)
                        {
                            result.Attributes["activityid"] = new EntityReference(entity.LogicalName, entity.Id);
                        }
 }
                }
                catch (Exception ex)
                {
                    throw new InvalidPluginExecutionException(ex.Message);
                }
            }
}

How can I use a late bound attribute as the DataTextField of a combobox in asp.net?

$
0
0

Relevant snipped from my aspx page:

<telerik:RadComboBox runat="server" AutoPostBack="True" ID="CboLists" EmptyMessage="Kies een marketinglijst"
         DataValueField="Id" HighlightTemplatedItems="True" OnSelectedIndexChanged="CboLists_OnSelectedIndexChanged"
        Width="200px" DataSourceID="MarketingListDataSource" DataTextField="<!--What do I enter here?-->"><ItemTemplate><table><tr><td><b><%# DataBinder.Eval(Container.DataItem, "Attributes['listname']") %></b> (<%# ViewHelper.GetBooleanValue("list", "type",(bool)((Entity)Container.DataItem).Attributes["type"]) %>)</td></tr><tr><td><%# DataBinder.Eval(Container.DataItem, "Attributes['membercount']") %> Leden</td></tr></table></ItemTemplate></telerik:RadComboBox><asp:ObjectDataSource runat="server" ID="MarketingListDataSource" TypeName="aca.crm2011.sendgrid.MarketingListEngine"
         OnObjectCreating="MarketingListDataSource_OnObjectCreating" SelectMethod="GetAllMarketingLists"/>

I want to display the listname as the DataTextField of my combobox. Is there a way to do this without using early binding?

Filtered lookup field default view issue CRM 2011

$
0
0

Hi everyone,

i'm exepriencing a strange issue tempting to filter a lookup dialog in Connection system entity.
In substance i created a Jscript that is fired on "Name" field OnChange event: if the chosen entity type is "systemuser" the Jscript adds to the lookup field "As this role" a custom view filtered only on my roles with success. Adding the view i set it as default but, inexplicably, the default view is not changed (compared to usual) and i can visualize all system connection roles.

I also tried to disable programmatically the view picker, again without success.

Here is my code:

function OnDestinationChange() {
    var connectionDestinationType = Xrm.Page.getAttribute("record2id").getValue()[0].entityType;

    if (connectionDestinationType == "systemuser") {
        var defaultLookupViewId = "{108E1BE5-BE0B-4B9F-9827-80841CDD5F48}";

        var viewId = "{B21D26A7-6E68-4775-A425-CC045E832E7F}";
        var entityName = "connectionrole";
        var displayName = "Ruoli di connessione filtrati";

        var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +"<entity name='connectionrole'>" +"<attribute name='category' />" +"<attribute name='name' />" +"<attribute name='connectionroleid' />" +"<attribute name='statecode' />" +"<order attribute='category' descending='false' />" +"<filter type='and'>" +"<condition attribute='name' operator='eq' value='Parte Interessata' />" +"</filter>" +"</entity>" +"</fetch>";

        var layoutXml = "<grid name='resultset' object='1' jump='connectionroleid' select='1' icon='1' preview='1'>" +"<row name='result' id='connectionroleid'>" +"<cell name='name' width='200' />" +"<cell name='category' width='200'/>" +"</row>" +"</grid>";

        Xrm.Page.getControl("record2roleid").addCustomView(viewId, entityName, displayName, fetchXml, layoutXml, true);
        document.getElementById("record2roleid").disableViewPicker = 1;
    }
    else {
        document.getElementById("record2roleid").disableViewPicker = 0;
        Xrm.Page.getControl("record2roleid").setDefaultView(defaultLookupViewId);
    }
}
Can someone help me?

Thanks in advance.



How to execute Report in Dynamics CRM 2013 to generate PDF in Online mode and offline

$
0
0

Could some one help me out !!! I have got a custom button in the Entity Quote to generate a PDFs file from a report . It work perfectly if the CRM is on-line , but once I switch in to outlook as offline mode it is not working . Because it is not getting a Session id and Control Id

var pth="";if(IsOnline){
        pth=Xrm.Page.context.getServerUrl()+"/CRMReports/rsviewer/reportviewer.aspx";}else{
        pth=" http://localhost:2525/crmreports/viewer/viewer.aspx";}var retrieveEntityReq =newXMLHttpRequest();varId=Xrm.Page.data.entity.getId();var quotationGUID =Id.replace('{',"");//set this to selected quotation GUID
        quotationGUID = quotationGUID.replace('}',"");var reportName ="Quote";//set this to the report you are trying to downloadvar reportID ="6A39D18F-2EC6-E344-8986-F49D6765A723";//set this to the guid of the report you are trying to downloadvar rptPathString ="";//set this to the CRMF_Filtered parametervar strParameterXML ="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition attribute='quoteid' operator='eq' uitype='quote' value='"+ quotationGUID +"' /> </filter></entity></fetch>";
        retrieveEntityReq.open("POST", pth,false);
        retrieveEntityReq.setRequestHeader("Accept","*/*");
        retrieveEntityReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        rptPathString ="id=%7B"+ reportID +"%7D&uniquename="+Xrm.Page.context.getOrgUniqueName()+"&iscustomreport=true&reportnameonsrs=&reportName="+
        reportName +"&isScheduledReport=false&p:CRMAF_Filteredquote="+ strParameterXML;//remove the part starting from &p:salesorderid if your report has no parameters
        retrieveEntityReq.send(rptPathString);var x = retrieveEntityReq.responseText.indexOf("ReportSession=");var ret =newArray();
        ret[0]= retrieveEntityReq.responseText.substr(x +14, retrieveEntityReq.responseText.indexOf("&", x)- x -14);//the session id
        x = retrieveEntityReq.responseText.indexOf("ControlID=");
        ret[1]= retrieveEntityReq.responseText.substr(x +10, retrieveEntityReq.responseText.indexOf("&", x)- x -10);//the control idreturn ret;

Viewing all 465 articles
Browse latest View live


Latest Images