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

Sql query to get data from audit history for opportunity entity

$
0
0

HI All,

This query get the data from Audit history table.

I query the audit table to get where entityname  = opportunty.

I need to also filter it by attributename = 'funnelphase'

how do I do this.

Declare @attributes VarChar(Max), @values VarChar(Max), @ObjectTypeCode int, @LogDateTime DateTime, @RecordId uniqueidentifier, @UserId Uniqueidentifier, @ActionId int


Declare @Result Table(AttributeId int, Value VarChar(Max),CurrentValue VarChar(Max), ObjectTypeCode int,
LogDateTime DateTime, RecordId uniqueidentifier, UserId uniqueidentifier, ActionId int, EntityName nvarchar(128),AttributeName1 nvarchar(100))
Declare @CurrentAttribute VarChar(max), @CurrentValue VarChar(Max)

DECLARE DataAuditCursor CURSOR FOR
Select all
Case When IsNull(a.AttributeMask, '') = '' Then '' Else Substring(a.AttributeMask, 2, Len(a.AttributeMask) - 2) End
,a.ChangeData
,a.ObjectTypeCode
,a.CreatedOn
,a.ObjectId
,a.UserId
,a.[Action]
From dbo.AuditBase a
where a.AttributeMask is not null and a.AttributeMask <> ''
OPEN DataAuditCursor

FETCH NEXT FROM DataAuditCursor
INTO @attributes, @values, @ObjectTypeCode, @LogDateTime, @RecordId, @UserId, @ActionId

WHILE @@FETCH_STATUS = 0
BEGIN
WHILE CHARINDEX(',',@attributes,0) <> 0
BEGIN
SELECT
@CurrentAttribute=RTRIM(LTRIM(SUBSTRING(@attributes,1,CHARINDEX(',',@attributes,0)-1))),
@attributes=RTRIM(LTRIM(SUBSTRING(@attributes,CHARINDEX(',',@attributes,0)+1,LEN(@attributes)))),
@CurrentValue=RTRIM(LTRIM(SUBSTRING(@values,1,CHARINDEX('~',@values,0)-(case when CHARINDEX('~',@values,0)<=0 then 0 else 1 End)))),
@values=RTRIM(LTRIM(SUBSTRING(@values,CHARINDEX('~',@values,0)+1,LEN(IsNull(@values,0)))))

IF LEN(@CurrentAttribute) > 0
INSERT INTO @Result Values(CAST(@CurrentAttribute as nvarchar), @CurrentValue,@CurrentValue, @ObjectTypeCode, @LogDateTime, @RecordId, @UserId, @ActionId,null,null)
END

INSERT INTO @Result Values((Case When IsNull(@attributes, '') = '' Then Null Else CAST(@attributes as nvarchar) End), @values,@CurrentValue, @ObjectTypeCode, @LogDateTime, @RecordId, @UserId, @ActionId,null,null)

FETCH NEXT FROM DataAuditCursor
INTO @attributes, @values, @ObjectTypeCode, @LogDateTime, @RecordId, @UserId, @ActionId
END

CLOSE DataAuditCursor;
DEALLOCATE DataAuditCursor;

Update r
SET r.EntityName = m.Name
from @Result r
inner join  MetadataSchema.Entity m
on  r.ObjectTypeCode = m.ObjectTypeCode

Select
r.EntityName
,r.AttributeName1
,u.fullname UserName
,r.Value OldFieldValue
,r.RecordId ModifiedRecordId
From @Result r
Left Join FilteredSystemUser u On r.UserId = u.systemuserid
where r.EntityName='Opportunity' ;



deleting custom button on ribbon workbench

$
0
0

Hello,

I need to delete a custom button on ribbonworkbench. When i publish i had this

error. i deleted the command and actions. How can i resolve this problem?

 

Dynamics CRM 2015 Web Resource One line and Intellisense overlay to the CRM Form........

$
0
0

I am looking for any assistance on customizing HTML Webresource with only one Textbox as a Field in one line in Any Entity Form and then when user type on textbox display intellisense which overlay the below fields. I know in the past there were some limitations..to this.

Problems with the web Application Walkthrough

$
0
0

I am attempting to go thru the exercise outlined in:

Walkthrough:Build a Web Application That Connects to Microsoft Dynamics CRM Using Developer Extensions

https://msdn.microsoft.com/en-us/library/gg695790(v=crm.5).aspx

I can't get past the first step - Generate Early Bound Types.

I checked to make sure that Microsoft.Xrm.Client.CodeGeneration.dll was in the same folder as crmsvcutil.exe (folder=CRMSDK2011/SDK/bin). Then I navigated to the CRMSDK2011/SDK/bin folder and copied the msdos command into a command prompt and hit 'return'.

I get an error:

Exiting program with exception: Metadata contains a reference that cannot be res
olved: 'http://crm/Contoso/XRMServices/2011/Organization.svc?wsdl'.
Enable tracing and view the trace files for more information.

I tried putting the url directly into a browser and get an error that the site can't be reached.

How do I go about getting past this?

Thanks in advance.

Connect To SQL Database While Using CRM Online

$
0
0

Can anyone tell me how to get data from CRM Online into my SQL Server database? I've searched the web and see that Sandbox access only allows HTTP/HTTPS

As expected, when I try to connect to my database I get the error saying SqlClient trust failed.

This is my code:

         string connString =
                @"Data Source=XXXXXXXXX\XXXXXXX;Initial Catalog=CRMTestingDatabase;" +
                "User ID = ME; Password = XXXXXXXX";


            SqlConnection _sqlConnection = new SqlConnection(connString);
            SqlCommand _sqlCommand = new SqlCommand();
            _sqlCommand.CommandType = CommandType.StoredProcedure;
            _sqlCommand.CommandText = "usp_InsertContact";

            try
            {
                //Stored Proc parameters
                _sqlCommand.Parameters.Add("@FName", SqlDbType.NVarChar).Value = firstname;
                _sqlCommand.Parameters.Add("@LName", SqlDbType.NVarChar).Value = lastname;
                _sqlCommand.Parameters.Add("@Add1", SqlDbType.NVarChar).Value = street1;
                _sqlCommand.Parameters.Add("@Add2", SqlDbType.NVarChar).Value = street2;
                _sqlCommand.Parameters.Add("@City", SqlDbType.NVarChar).Value = theCity;
                _sqlCommand.Parameters.Add("@State", SqlDbType.NVarChar).Value = theState;
                _sqlCommand.Parameters.Add("@Zip", SqlDbType.NVarChar).Value = zipCode;
                _sqlCommand.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = telePhone;

                //associate the connection to the command and open
                _sqlCommand.Connection = _sqlConnection;
                _sqlConnection.Open();

                //execute the Stored Procedure
                _sqlCommand.ExecuteNonQuery();

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                //Release the connection
                _sqlConnection.Close();

            }

deleting custom button on ribbon problem

$
0
0

Hello,

I am trying to delete a custom button created by ribbonworkbench. I have an issue every time when i make change and try to publish. i receive an error.

How can i do that?

Thanks by advance

Regards

Mark Complete button issue in plugin

$
0
0

Hi,

I have plugin registered on "SetStateDynamicEntity" message on post operation, that checks the status of the phone call record when a phone call is closed.

When I close the phone call "made" using the CLOSE PHONE CALL button then got the status reason value as 2 inside the plug-in.

But when I use the MARK COMPLETE button the status reason value returned is -1.

Here is my code.

Int32 statusvalue = ((OptionSetValue)myContext.InputParameters["Status"]).Value; 

Any help would be appreciated.

Thanks 


Balasaheb

[BUG] CRM 2016 readonly form - getFormType and lookup

$
0
0

Environment is CRM 2016 SP1 on premise.

When a (case) record is [Active - Read only] a form custom relationship filtered lookup is still active even though the record cannot be saved.

Furthermore, assessing the form type in order to selectively hide the lookup returns a value of 2 (updatable) even when the record is readonly.

The only workaround is to use RetrievePrincipalAccess to check.

Thanks


Disable users through workflow

$
0
0

Hello All,

I want to write job which will trigger every month and disable users.

I feel recurring workflow will be best option for this. But I am not able to get Change status option for User entity.

Can anyone suggest on this?

Problem deleting custom entity from default solution

$
0
0

I am using CRM Online hosted by Microsoft

I am trying to delete a custom entity from my default solution and the entity isn't included in any of our custom solutions.
This custom entity was part of a custom solution that has since been deleted. Now when trying to delete this entity from the default solution I see the following error in ErrorDetails log:

<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B5C0852A</Message>

<ErrorCode>-2147220970</ErrorCode>

<Message>There should be at least one entity returned. Count: 0</Message>

Email Signature not populated in the email description in MS CRM 2013

$
0
0

Hello All,

Can anyone help me solving the below issues? Any help is greatly appreciated.

Requirement: We need to set the Signature automatically when replying to the email messages (Email) in CRM 2013.

Approach 1: Written the below code and set it to run AddSignatureToEmail() onLoad of the Email form.

function AddSignatureToEmail() {

    // Pre-fill a template signature
    var drawSignature = false;                  
    var emailTemplateToLoad = "5E4DB80E-CF36-E611-8100-00155DAD0221";//Signature TemplateID
    // Check if description is blank or similar
    var theDescription = Xrm.Page.getAttribute("description").getValue();
    if (theDescription == null) {
        drawSignature = true;
    } else if (theDescription == undefined) {
        drawSignature = true;
    } else if (stripHTML(theDescription) == "") {
        drawSignature = true;
    } else if (stripHTML(theDescription).length < 10) {
        drawSignature = true;
    }
    if (drawSignature) {
        // Get user details
        var systemUserId = Xrm.Page.context.getUserId();
        if (systemUserId != null) {
            // Retrieving email template details
            var command = new RemoteCommand("EmailTemplateService", "GetInstantiatedEmailTemplate");
            command.SetParameter("templateId", emailTemplateToLoad);
            command.SetParameter("objectId", systemUserId);
            command.SetParameter("objectTypeCode", 8);
            var result = command.Execute();
            if (result.Success) {
                var o = new Object();
                o.EmailBody = "";
                o.EmailSubject = "";
                if (typeof (result.ReturnValue) == "string") {
                    // Create a Xml Document of the return value to retrieve actual data
                    oXml = CreateXmlDocument(result.ReturnValue);
                    o.EmailBody = oXml.lastChild.lastElementChild.textContent;

                    Xrm.Page.getAttribute("description").setValue(o.EmailBody);
                    Xrm.Page.getAttribute("description").setSubmitMode("always");
                }
            }
        }
    }
}
function stripHTML(signature) {
    var tmp = document.createElement("DIV");
    tmp.innerHTML = signature;
    return tmp.textContent || tmp.innerText;
}
function CreateXmlDocument(signatureXmlStr) {
    // Function to create Xml formate of return email template data
    var parseXml;
    if (window.DOMParser) {
        parseXml = function (xmlStr) {
            return (new window.DOMParser()).parseFromString(xmlStr, "text/xml");
        };
    }
    else if (typeof window.ActiveXObject != "undefined" && new window.ActiveXObject("Microsoft.XMLDOM")) {
        parseXml = function (xmlStr) {
            var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async = "false";
            xmlDoc.loadXML(xmlStr);
            return xmlDoc;
        };
    }
    else {
        parseXml = function () { return null; }
    }
    var xml = parseXml(signatureXmlStr);
    if (xml) {
        return xml;
    }
}

By using the above code I could get my signature email template body properly but couldn’t set the same to description field of Email entity.

Issues:

1a) I could get my signature email template body in o.EmailBody but couldn’t set that value to the ‘description’ field of Email. Signature not displayed after clicking on reply in the Email form. However, the signature is set accordingly when it is a new form (onLoad).

1b) In some emails, the signature was seen after clicking on reply in the Email form and that too in Google Chrome only.

1c) Observed that the email description field is always giving empty value (null) when the value is get using Xrm.Page.getAttribute(“description”).getValue();
========================================================================
Approach 2:

http://www.inogic.com/blog/2015/07/adding-signature-to-emails-in-dynamics-crm/#comment-1093

Used the above same logic but stuck up with the below issues.

Issues:

2a) Couldn’t get any description or subject field for var ‘result’ and couldn’t set the value to Email description.

2b) How to get the description of the email template from the var ‘result’ and assign the same to description field of Email? I could see my signature template information in the ‘result’ but it is not proper.

2c) If this script is triggered on OnLoad of the email form, – will it not effect the user adding the signature only if the user wants to open the form. The user should only see the signature while replying to the email and append it to the existing description of the email.



Thanks,

Srini

                    

USD CTI Simulator is not able to connect to the remote server

$
0
0

Hello Devs,

I was just exploring the CTI functionality of Unified Service Desk (USD). I configured the CTI Desktop Manager in the USD following this walkthrough (Walkthrough: Use the generic listener adapter for CTI event routing)

Now when I am going to sent the CTI event to the USD using CTI simulator application, the operation fails with the error "Unable to connect to the remote server".

Any ideas what am I missing?

USD CTI Simulator - Unable to connect to the remove server



blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

CRM2011 crmSvcUtil.exe Error: Metadata contains a reference that cannot be resolved

$
0
0

Hi,
I tried to execute the following
crmsvcutil.exe /url:https://server1/org1/XRMServices/2011/Organization.svc /out:sdk.cs /username:myusername /password:mypassword  /namespace:crm.Sdk

and received following error:

Exiting program with exception: Metadata contains a reference that cannot be res
olved: 'https://server1/org1/XRMServices/2011/Organization.svc?wsdl'.
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: Metadata contains a reference that cannot be resolved
 ---> System.Net.WebException: The operation has timed out

   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRet
riever.DownloadMetadata(TimeoutHelper timeoutHelper)
   at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.R
etrieve(TimeoutHelper timeoutHelper)
   --- End of inner exception stack trace ---
   at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.R
etrieve(TimeoutHelper timeoutHelper)
   at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(Resolve
CallState resolveCallState)
   at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Metadat
aRetriever retriever)
   at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpoints(T
ype contractType, Uri serviceUri)



What could be the possibilities?


Displaying information from either one of the entity in single column for a custom view using FetchXML

$
0
0

I have a field called 'region' which is common in 'Account' entity and 'Contact' entity and I need to display in it in single column meaning, the region information should come from Account if it is not there then from Contact entity. But the information should be displayed in single column 'Region' in custom view.

Thanks in advance!

Custom in USD

$
0
0

Hi All,

I am new comer in USD dynamics crm, I want to know how far we can custom within USD? Is it possible to create something like softphone ingrated with CTI and Cisco telephony system within USD?

ie: when incoming call occur, in USD screen will show pop up a softphone including softphone keypad and some custom button like transfer call or automatic create lead into CRM.?

if you guys have links that can explain regarding this its very helful for me :)

thanks


Unable to cast object of type 'Microsoft.Crm.Reporting.DataExtension.Client.Fetch.FetchProxy' to type 'Microsoft.Crm.Sandbox.SandboxFetchProxy'.

$
0
0

Hi All,

I am trying to create a report in CRM Online where I am getting the following error

Unable to cast object of type 'Microsoft.Crm.Reporting.DataExtension.Client.Fetch.FetchProxy' to type 'Microsoft.Crm.Sandbox.SandboxFetchProxy'.


Here is what I am trying to do. We have a cost associated with appointment in which contact are added as required attendees. We want to track cost of appointment per account and the bills that have been raised against these account. For this I have created the following FetchXML

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true"><entity name="appointment"><attribute name="new_cost"  alias='new_cost' aggregate='sum' /><link-entity name="activityparty" from="activityid" to="activityid" alias="bd"><link-entity name="contact" from="contactid" to="partyid" alias="be"><link-entity name="account" from="accountid" to="parentcustomerid" alias="bf"><link-entity name="new_feesreferred" from="new_parentnameid" to="accountid" alias="bg"><attribute name="new_billed"  alias='new_billed' aggregate='sum' /><attribute name="new_parentaccount"  alias='new_parentaccount' groupby='true' /></link-entity></link-entity></link-entity></link-entity></entity></fetch>

I will much appreciate if anyone can help me in this or make any suggestions.


-Devashish
http://thecrmworld.wordpress.com
http://ebizartisans.com

SecLib::CrmCheckPrivilege failed. Returned hr = -2147220943 on UserId: 619c2ecf-2ada-e011-a042-005056860002 and PrivilegeType: Read

$
0
0

I am getting the following error message,did anyone come across

[FaultException`1: SecLib::CrmCheckPrivilege failed. Returned hr = -2147220943 on UserId: 619c2ecf-2ada-e011-a042-005056860002 and PrivilegeType: Read]

  System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14350190

  System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +388

  Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity) +0

  Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity) +788

  Ellucian.Core.Crm.Base.Data.OrganizationServiceProxyWrapper.Update(Entity entity) in d:\c\53\DynamicsCRMCore\Main\Sources\Source\Ellucian.Core.Crm.Base\Data\OrganizationServiceProxyWrapper.cs:134

  Ellucian.ERecruiting.Web.Controls.Application.ApplicationControl.SetSignatureDate(CrmData data, Entity subApplication) in d:\c\60\eRecruiting\Recruit_Abbott\Sources\Source\Ellucian.ERecruiting.Web\Controls\Application\ApplicationControl.cs:1757

  Ellucian.ERecruiting.Web.Controls.Application.ApplicationControl.SetupExistingApplication(CrmData data, Guid applicationID, Guid userID) in d:\c\60\eRecruiting\Recruit_Abbott\Sources\Source\Ellucian.ERecruiting.Web\Controls\Application\ApplicationControl.cs:1468

  Ellucian.ERecruiting.Web.Controls.Application.ApplicationControl.OnLoad(EventArgs e) in d:\c\60\eRecruiting\Recruit_Abbott\Sources\Source\Ellucian.ERecruiting.Web\Controls\Application\ApplicationControl.cs:502

  System.Web.UI.Control.LoadRecursive() +68

  System.Web.UI.Control.LoadRecursive() +165

  System.Web.UI.Control.LoadRecursive() +165

  System.Web.UI.Control.LoadRecursive() +165

  System.Web.UI.Control.LoadRecursive() +165

  System.Web.UI.Control.LoadRecursive() +165

  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4498

Passing Annotations in CRM Organization Web Service

$
0
0

Hi All,

We have a requirement to pass an image file from BizTalk while creating an Entity in CRM, this image would be linked to that Entity. From doing some R&D I can see that attachments can be uploaded as Annotations using the Organization service but the problem is all the examples are showing the use of SDK and we are calling the Organization Web Service directly without using the SDK i.e. Key Value pairs in the XML, question is how do we pass Annotations in XML?

Thanks

Syed

CRM Online Copy instance automation

$
0
0
I need to do a copy instance operation as part of a test script.  Is there a powershell cmdlet that can do this or an API I can use?

CRM 2011: Dialog, "finish button" and child workflow...

$
0
0

I have created a dialog that runs from the account which asks the user "Email or fax form?" and two radio buttons: fax & email. If the user selects email, it directs to the next page and the user enters an email address. If the user selects fax, it goes to a different page and enters the fax number. So far, so good.

After the email address or fax number page is shown and data entered, the user clicks next. The problem is that after clicking next, the custom workflow fires sending the email or fax but the user is taken to the CRM generated page that has a "Finish" button along with a "Cancel" button. If the user were to get there and click "Cancel", they would expect the fax or email to not be sent, but the custom workflow has already fired and the email/fax has been sent.

What it seems I need is a way to run my child workflow *after* the user presses "Finish" on the last page of the dialog. Is there any way to do that?

Thanks,

Jeff

 

Viewing all 8223 articles
Browse latest View live