Advertisements

Archive

Archive for October 7, 2019

D365/CRM – Document Template – Missing entity relationship

Other day, I was configuring a ‘Document Template’ for a custom entity (Acknowledgement) which has a 1:N Relationship with Contact entity.

DocTemp_1

For some reason, the Relationship was not showing up in the ‘1:N Relationship’ grid of the ‘Document Template’ configuration screen.

DocTemp_2

Reason & Fix:

  • The relationship ‘Searchable’ field was set to ‘No’ and hence it was not showing in the list.
  • Set the ‘Searchable’ field to ‘Yes’ and publish.

DocTemp_3

  • Refresh the Document Template’s ‘1:N Relationship’ grid and you should see the relationship now.

DocTemp_4

🙂

Advertisements
Categories: CRM Tags: ,

CRM (on-prem) – Entity reference cannot have Id and Key Attributes empty error

We encountered below exception from a custom workflow activity in our Dynamics CRM on-prem 8.2.3 application.

WF_Error1

Reason and Fix:

  • Error message states that the ‘Output’ argument defined in custom workflow activity was returning ‘Null’.
  • I have below output argument of type ‘Lookup’ defined in my custom workflow activity but it always having value.

WF_Error3

  • Error was misleading in our case, as our debug concluded that the Output argument was always having value.
  • After spending considerable time, we figured out that the issue was due to a change at CRM website level.
  • Our IT team enabled SSL and added https binding to our dynamics website which caused this issue.
  • We had to set the custom workflow assemblies Isolation mode to ‘Sandbox’ to get the workflow running.

WF_Error2

Note:

  • This issue occurred only on UAT server but not on DEV instance, which also had SSL enabled same time.
  • Issue could be due to security policies enabled between the CRM application server and platform server on UAT.

🙂

Categories: CRM Tags: ,

Web Development – Useful jQuery Syntax’s

In this article, I am compiling the useful jQuery syntax’s which comes handy during your Dynmaics/ADX portal development or any other web development.

Prerequisite

  • Add jQuery library to your web page using <script> tag.
  • You can get the jQuery CDN here

Get Operations:

  • Get HTML element by Id

$(“#HTMLelementId“)

  • Get element by Class name

$(“.ClassName“)

  • Get element by ‘partial’ Id name.
    • As an example, if you want to get a Checkbox control which has ID ‘myChkBox‘, you can either get the element using full id with $(“#myChkBox”) or use partial id $(“[id$=’ChkBox‘]”).

$(“[id$=’PartialId‘]”)

  • Get Value

$(“#HTMLelementId“).val()

  • Get selected drop down text

$(“#DropdownId option:selected”).text()

Set Operations:

  • Set Text box

$(“#HTMLelementId“).val(“Hello World”);

  • Set Checkbox

$(“#checkboxId“).prop(“checked”, true); //true is checked; false is unchecked.

Add or Remove Class

  • $(“#HTMLelementId“).addClass(“YourClassName“); // Add Class
  • $(“#HTMLelementId“).removeClass(“YourClassName“); // Remove Class

Hide/Show Element

  • Hide element

$(“#HTMLelementId“).hide();

  • To hide Parent
    • This is useful to hide a control along with Label.

$(“#HTMLelementId“).parent().hide()

  • Show element

$(“#HTMLelementId“).show();

Check if elements exists

if ($(“#HTMLelementId“).length > 0){}

Iteration syntax

  • Loop through all Radio boxes which set to False.

$(“input[id][type=’radio’][value=’0′]”).each(function () {
var radioBox = this;
});

Attach events to HTML elements

  • To add ‘keypress’ event to Text box

$(“#HTMLelementId“).on(“keypress”, keyPressHandler);

function keyPressHandler(){
// Read the textbox value
var controlValue = this.val();
}

Remove event handler

  • To remove ‘onChange’ event from a control use ‘unbind’ method.

$(“#dropDownID“).unbind(“change”);

Trigger event

  • To trigger button ‘Click’ event

$(“#ButtonId“).click();

Remove option from Drop down:

  • Below script, removes ‘Mango’ from the Drop down control.

jQuery(“#dropdownId option:contains(‘Mango’)”).remove();

Read Query String Parameter

  • To read ‘country’ param value from current URL http://helloworld?country=India, call getParamValue(‘country’)
  • Function will return false, if no matching param found.

function getParamValue(paramName) {
var results = new RegExp(‘[\?&]’ + paramName + ‘=([^&#]*)’)
.exec(window.location.search);

return (results !== null) ? results[1] || 0 : false;
}

Create a new element:

  • Below is the snippet to create HTML button and add that next to an existing HTML element.

$(‘<input type=”button” id=”newBtn” class=”Your class name” value=”My New Button”/>’).insertAfter($(“#existingHTMLElementId“));
$(“#newBtn”).click(function () {

// Write your onclick script here
});

Categories: CRM, ADX Tags: ,