RSS

SOAP Requests parameters for actions in CRM 2013

When you are trying to reach actions in CRM 2013 from javascript the request looks like this

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <request xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
        <a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
        <!-- List of parameters -->
        </a:Parameters>
        <a:RequestId i:nil="true" />
        <a:RequestName>new_myactivity</a:RequestName>
      </request>
    </Execute>
  </s:Body>
</s:Envelope>

Each parameter looks like this

String

<a:KeyValuePairOfstringanyType>
  <b:key>lastname</b:key>
  <b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">Smith</b:value>
<a:KeyValuePairOfstringanyType>

Boolean

<a:KeyValuePairOfstringanyType>
  <b:key>updateoriginator</b:key>
  <b:value i:type="c:boolean" xmlns:c="http://www.w3.org/2001/XMLSchema">true</b:value>
</a:KeyValuePairOfstringanyType>

Int

<a:KeyValuePairOfstringanyType>
  <b:key>Number</b:key>
  <b:value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema">10</b:value>
</a:KeyValuePairOfstringanyType>

Datetime

<a:KeyValuePairOfstringanyType>
  <b:key>birthdate</b:key>
  <b:value i:type="c:dateTime" xmlns:c="http://www.w3.org/2001/XMLSchema">2013-10-27T01:08:29.0439804+03:00</b:value
</a:KeyValuePairOfstringanyType>

Optionset

<a:KeyValuePairOfstringanyType>
  <b:key>Status</c:key>
  <b:value i:type=\"a:OptionSetValue\">
    <a:Value>1</a:Value>
  </b:value>
</a:KeyValuePairOfstringanyType>

Lookup

<a:KeyValuePairOfstringanyType>
  <b:key>Target</b:key>
  <b:value i:type=\"a:EntityReference\">
    <a:Id>1B4A86F7-CCC5-4D3E-B486-5E7CF66EC700</a:Id>
    <a:LogicalName>incident</a:LogicalName>";
    <a:Name i:nil=\"true\" />
  </b:value>
</a:KeyValuePairOfstringanyType>

Money

<a:KeyValuePairOfstringanyType>
  <b:key>DecimalInArgument</b:key>
  <b:value i:type='a:Money'>
    <a:Value>1</a:Value>
  </b:value>
</a:KeyValuePairOfstringanyType>
 
2 Comments

Posted by on December 4, 2013 in CRM 2013, Javascript

 

Tags: , ,

Import solution progress in SQL

Use <<OrgName_MSCRM>>
Go

SELECT TOP 1
    progress                                 [Progress%],
    Solutionname                             [SolutionName],
    DATEADD(hh, 5.5, startedon)              [StartedOnPST],
    DATEADD(hh, 5.5, completedon)            [CompletedOnPST],
    DATEDIFF(second,startedon,completedon)   [TimeTakenInSec],
    DATEDIFF(minute,startedon,completedon)   [TimeTakenInMin],
    createdbyname                            [ImportedBy],
    OrganizationIdName                       [OrgName],
    Data                                     [ImportOutput]
FROM
    importjob IJ (NOLOCK)
ORDER BY
    IJ.startedon DESC
 
Leave a comment

Posted by on October 10, 2013 in SQL

 

Tags: , , , ,

Get picklist text from SQL

Sometimes we’re making a report or something using SQL and the optionset (picklist) fields retrieve us just the value in the picklist but not the text. So I made a function who retrieves me the selected text value, here it is:


CREATE FUNCTION [dbo].[Isaac_FN_GetPicklistText]
(
@AttributeName varchar(50),
@ObjectTypeCode int,
@AttributeValue int,
@Language int
)
RETURNS nvarchar(50)

AS
Begin
RETURN
(
SELECT Value
FROM StringMap
WHERE AttributeName=@AttributeName
AND ObjectTypeCode=@ObjectTypeCode
AND AttributeValue=@AttributeValue
AND LangId=@Language
)
End

If it helps you leave me a comment =)

 
Leave a comment

Posted by on February 14, 2013 in CRM 2011, SQL

 

Tags: , , , ,

Visual Ribbon Editor. ‘The required attribute ‘PropertyValue’ is missing.’

I was using Visual Ribbon Editor and wanted to add Display Rule of type EntityPropertyRule when I wanted to save the ribbon I get the error:

This is caused because the Visual Ribbon Editor let us add PropertyName BUT NOT PROPERTY VALUE!!! so if you want to add this rule do it manually. Driver yourself to the section <DisplayRules> and add manually the rule like this

<DisplayRule Id="MyId.Form.contact.MainTab.Save.deactivate.Command.DisplayRule.EntityPropertyRule">
<EntityPropertyRule AppliesTo="PrimaryEntity" PropertyName="HasStateCode" PropertyValue="true"/>
</DisplayRule>
 
Leave a comment

Posted by on January 2, 2013 in CRM 2011, Ribbon, Solving Errors

 

Tags: , , ,

Open Associated View From Url

To open Associated View from URL you need to form the URL like this

http://%5BServerName%5D/%5BOrganizationName%5D/userdefined/areas.aspx?oId=%5BActualRegisterGuid%5D&oType=%5BEntityTypeCode%5D&pagemode=iframe&security=65591&tabSet=%5BRelationshipName%5D

Note: Check that you use the RelationshipName and not LookupName

 
Leave a comment

Posted by on December 11, 2012 in Javascript, Unsupported

 

Tags: , , ,

system.serviceModel/behaviors: assembly does not allow partial trust

I had a console application with a service reference. When I tried to run it in the test environment. I get the error: system.serviceModel/behaviors: assembly does not allow partial trust so I saw in my app.conf the following lines:


<system.serviceModel>
<bindings />
<client />
</system.serviceModel>

I saw that I didn’t use this rows, and I deleted them from y configuration file and it worked perfectly.

 
Leave a comment

Posted by on October 30, 2012 in CRM 2011, Solving Errors

 

Tags: , ,

Dynamics CRM 2011 JavaScript “Access is Denied” Error With Ajax Call

Sometimes when we want to use Ajax to retrieve data from CRM inside the server works perfectly but outside we found permission exception like this

 

 

 

 

 

 

 

That’s been caused by a problem in the instruction

[sourcecode language=”javascript”]
Xrm.Page.context.getServerUrl()
[/sourcecode]

just change it to

[sourcecode language=”javascript”]
document.location.protocol + “//” + document.location.host + “/” + Xrm.Page.context.getOrgUniqueName();
[/sourcecode]

For more information: http://www.madronasg.com/blog/dynamics-crm-2011-javascript-%E2%80%9Caccess-denied%E2%80%9D-error-ajax-call

 
1 Comment

Posted by on September 20, 2012 in CRM 2011, Javascript, oData

 

Tags: , , , , ,

Create CRM Class Context From CRM Service WSDL

You can use the CrmSvcUtil command-line tool to generate the data context and data transfer object classes for your Microsoft Dynamics CRM organization.

The command that I normally use is:

C:\..\sdk\bin\CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:C:\..\MySolution\MyProject\Context.cs /url:https://servername/organizationname/XRMServices/2011/Organization.svc /domain:mydomain /username:myusername /password:mypassword /namespace:Xrm /serviceContextName:XrmServiceContext</p>

For more information about parameters or examples CrmSvcUtil Command-Line Parameters

 
Leave a comment

Posted by on July 23, 2012 in CRM Information

 

Tags: ,

IE Crashes when closing a form too quickly (CRM 2011)

I have noticed that if I close an account (or really any form incident, contact, etc) form in CRM 2011 before it fully loads that it will crash IE.  It doesn’t happen always and it seems to be a timing issue but it is easy to reproduce. Sometimes we will see the “Microsoft Dynamics CRM has encountered and error” popup window, but most times it will just crash the entire IE session (including the parent window) with IE saying “A problem with this webpage caused the tab to close and re-open” which brings the user back to their default start page.

This is an annoyance right now but seems like a Bug that is bound to come up in a user’s course of the day when they are heavily using CRM.

Most likely the IE crash is caused by an issue of “IE Hang Resistance feature”.  What I read is that IE team is working on this IE 9 issue.

Setting the below registry entry could work around the issue for now.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\ 
Type: REG_DWORD
Name: HangRecovery
Value: 0

Original Post social.microsoft.com

 
2 Comments

Posted by on July 23, 2012 in Solving Errors, Unsupported

 

Tags: , ,

CRM 2011: Get the Right Server URL in Your CRM Client Script

During one of the projects we encountered client-side errors many of Access Is Denied CRM server are one and not another CRM server of the same environment.
Source of errors discovered as queries odata with json, when there is a limitation permission to run queries between servers.
The following method is used to build the Url query the odata:If you have worked with Microsoft Dynamics CRM 2011 long enough, you have most likely used getServerUrl Do not know if it has been known to everyone. In any case, I think is worth passing on …

During the project work of Albert phenomena encountered client-side errors many of Access Is Denied CRM server are one and not another CRM server of the same environment.
Source of errors discovered as queries odata with json, when there is a limitation permission to run queries between servers.
The following method is used to build the Url query the odata


var odataQuery = "/XRMServices/2011/organizationData.svc/new_productSet(guid'" + new_product_id + "')?$select=new_approval_process";

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

var odataSelect = serverUrl + odataQuery;

getServerUrl always returned the first server installed in the environment, regardless of the server that runs the code, thus creating a remote odata query, which requires setting special permissions.

Instead, it is safer to use this code, always work on the local server, not on a remote server:


var odataQuery = "/XRMServices/2011/organizationData.svc/new_productSet(guid'" + new_product_id + "')?$select=new_approval_process";

var odataSelect = Xrm.Page.context.prependOrgName(odataQuery);

Attached article describes the problem and suggest a solution, but rather in response to it has a more elegant solution than the article suggests (if – that there is syntax error in omitting the object context of the code):
http://danielcai.blogspot.com/2012/02/get-right-server-url-in-your-crm-client.html

 
Leave a comment

Posted by on July 15, 2012 in CRM 2011, Javascript, oData

 

Tags: