Sunday, 19 February 2017

ADXStudio: An error occurred while processing the SOAP body. ACS50000: when connecting from Adxstudio Portal 7.0.0.01 to Microsoft Dynamics® CRM Online 2016 Update (8.1.0.549) (DB 8.1.0.526)

As you might aware that Dynamics CRM 365 Online gives you the option to Copy instance in the Dynamics 365 Administration Center to copy the Dynamics 365 application and all data from any instance to a Sandbox instance. You can do either a full or minimal copy.

You can go through below link to have a look the steps :

http://www.powerobjects.com/2014/08/14/create-copy-production-instance-dynamics-crm-online/

But if you are using ADXStudio Portal for your CRM instance, you might face below mentioned issue while copying the CRM online instance.

Copy Instance Issue in ADXStudio :


ACS10002: An error occurred while processing the SOAP body. ACS50000: There was an error issuing a token. ACS50001: Relying party with identifier 'https://*******.crm.dynamics.com/' was not found.
Trace ID: 78613603-34e2-4f5c-8da2-139f3188cc73
Timestamp: 2016-12-14 17:17:54Z
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ServiceModel.FaultException: ACS10002: An error occurred while processing the SOAP body. ACS50000: There was an error issuing a token. ACS50001: Relying party with identifier 'https://*******crm.dynamics.com/' was not found.
Trace ID: 78613603-34e2-4f5c-8da2-139f3188cc73
Timestamp: 2016-12-14 17:17:54Z

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Reason of this Issue :


This issue occurs because the Azure ACS namespace not setup properly during the restore operation, which causes the portal to be unable to authenticate when it's connecting.
This has been happening for a while and is probably a bug in the CRM organization restore process that Microsoft has built.


Solution of this Issue :


Solution 1 -

A workaround I've found is to rename the instance's URL temporarily to a different one, then immediately change the URL back again to the original one you want to use. The ACS namespace should in short order get setup and the portal will be able to authenticate and connect to CRM without error.


Solution 2 -

According to Microsoft Dynamics Support this is a fairly common problem. If above given workaround does not help to resolve your issue then without thinking too much raise a ticket with Microsoft, They run a command on the CRM online server which fixes ADFS issues for that instance.

When this Issue usually occurs ?

There might be following root cause of this issue :

  • When you are copying your Dynamic CRM 365 online Instances.
  • When you are restoring your Dynamic CRM 365 online Instance backup.
  • Invalid username or password in ADXStudio solution's connection string.
  • Password expired or changed after setup.
  • Time off by more than 5 minutes.
  • CRM Connection String Format Issue.
  • DLL Update Needed.
  • ADFS Issues


References: 

You can refer below links for more details: 

https://community.dynamics.com/crm/f/117/t/220412

https://community.adxstudio.com/forums/adxstudio-portals/e7c41187-c66a-e611-9400-000d3a1044cb



Hope this article help someone to resolve their issues..

Saturday, 21 January 2017

Client Side Validation using Javascript in ADXStudio

As we all know that Adxstudio does not support CRM form Java Scripts and Business Rules, so you need to create your own client validations scripts on ADX forms whatever you have written on CRM forms.

ADX forms only make field mandatory if it;s mandatory in CRM, if you want to make field mandatory conditionally For Example: If 'State' field value is 'Other' then 'Other' field should be visible and mandatory.

For these type of validations you will have to write your own JavaScript :

The following example demonstrates adding a custom validator. This particular example forces the user to specify an Phone only if the another field for preferred method of contact is set to 'Phone'.

if (window.jQuery) {
   (function ($) {
      $(document).ready(function () {
         if (typeof (Page_Validators) == 'undefined') return;
         // Create new validator
         var newValidator = document.createElement('span');
         newValidator.style.display = "none";
         newValidator.id = "mobilephoneValidator";
         newValidator.controltovalidate = "mobilephone";
         newValidator.errormessage = "<a href='#mobilephone_label'>Mobile Phone is a required field.</a>";
         newValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
         newValidator.initialvalue = "";
         newValidator.evaluationfunction = function () {
            var contactMethod = $("#preferredcontactmethodcode").val();
            if (contactMethod != 2) return true; // check if contact method is not 'Phone'.
            // only require Phone if preferred contact method is Phone.
            var value = $("#mobilephone").val();
            if (value == null || value == "") {
            return false;
            } else {
               return true;
            }
         };
 
         // Add the new validator to the page validators array:
         Page_Validators.push(newValidator);
 
         // Wire-up the click event handler of the validation summary link
         $("a[href='#mobilephone_label']").on("click", function () { scrollToAndFocus('mobilephone_label','mobilephone'); });
      });
   }(window.jQuery));
}


Note: Adxstudio forms only shows '*' on field label if the field is mandatory either in CRM or you are making the field mandatory using Entity Form Metadata.

If you making field mandatory using above mentioned ADXStudio given JavaScript code
It works well and make field mandatory, but it doesn't show '*' after field label.

Form will show field is mandatory on Submission of form at Top of the page.

If you want to show asterisk '*' on field label to let user know at the time of form filling, You need to write your own 3-4 line of JS code to show '*' after field label.

Here is the code to append asterisk on ADX form field:


 $('#inputfield_label_id').after('<span id="spanId" style="color: red;"> *</span>');                


Hope this post help someone, Please don't forget to write your feedback this will make me help to improvise and can provide you more and better content

Get Logged In User details using Liquid Template in ADXStudio

As we know that Liquid Template is one of the most powerful weapon of ADXStudio.

Today in this post i would like to share the information about how to get Current Logged In User details of ADXStudio Portal.

Where It is Useful ?


You might have came across so many requirements in which you require logged in user details -
  • Perform any Operation based on Current Logged In User.
  • Hide and Show Portal Content based on Current Logged In User.
  • Perform Redirection based on Current Logged In User. For Example: If  'User A' logged In on Portal, then he should be redirected to 'Page A' and 'User B' should redirected to 'Page B'.
  • Show different Home or Landing Page after Sign In based on Current Logged In User.
  • If User A has role Role A then do this, if Role B then do that.
  • Show Logged In User Account Details.
To achieve all the above requirements you must know about the Current Logged In User after sign in on Portal.

Liquid Template is the best way to achieve the same, Here is the example of the same:

'User'

{% if user %}
  Hello, {{ user.fullname }}!
{% else %}
  Hello, anonymous user!
{% endif %}
Here, 'user'  is an entity object.which refers to the current portal user, allowing access to all attributes of the underlying CRM contact record. If no user is signed in, this variable will be null.


'has_role'

{% assign is_admin = user | has_role: 'Administrators' %}
{% if is_admin %}
  User is an administrator.
{% endif %}
{% assign is_anonymous = user | has_role: 'Anonymous' %}
{% if is_admin %}
  User is an anonymous .
{% endif %}

Applied to a user object, returns true if the user belongs to the given role. Returns false if not.


By using above two features of ADXStudio, You can achieve all the above mentioned requirements.

I hope you all will get the valuable information, for any query feel free to drop me an email or comment on the post.

Friday, 20 January 2017

How to use Fetch XML in ADXStudio Liquid Template

Liquid is an open-source template language integrated into Adxstudio Portals. It can be used add dynamic content to pages, and to create a wide variety of custom templates.

You can learn more about Liquid Template from ADXStudio Community:

https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/liquid-templates/

In this post I would like to explain, how we can use Fetch XML to retrieve data from CRM in Liquid Template.


  1. {% fetchxml my_query %}
  2.   <fetch version="1.0" mapping="logical">
  3.   <!-- Write FetchXML here, use Liquid in here if you want, to build XML dynamically. -->
  4.   </fetch>
  5. {% endfetchxml %}
  6.  
  7. {{ my_query.xml | escape }}
  8. {{ my_query.results.total_record_count }}
  9. {{ my_query.results.more_records }}
  10. {{ my_query.results.paging_cookie | escape }}
  11. {% for result in my_query.results.entities %}
  12.   {{ result.id | escape }}
  13. {% endfor %}
  14.  
  15. <!-- You can also filter results by Entity Permissions -->
  16. {% fetchxml secure_query enable_entity_permissions: true, right: 'read' %}
  17. {% endfetchxml %}




Note - You must have appropriate Entity Permissions for data to be correctly retrieved. 
For example if you retrieving Contact Entity data using Liquid Template Fetch XML then you must have appropriate Entity Permissions on Contact Entity. (Contact, Account, Parent, Global).

Monday, 26 December 2016

Set Up CRM Portal in Dynamics CRM 365

Dynamic CRM 365 - CRM Portal







Dynamics CRM 365 is shaping up to be a one of the largest updates to CRM with the inclusion of new application extensions, Project Service, Field Service and most interesting CRM Portals.. 

Introducing of CRM Portals really removes a lot of the previous barriers there was to self-starting your installation and portal deployment, with a couple of clicks now you can get CRM Portals up and running with a ready to use scalable public facing site.

The following instructions will help you to set up newly integrated CRM Portal websites for your Dynamics CRM 365.

Step 1 Create Dynamic CRM 365 trial using below link:


https://signup.microsoft.com/Signup?OfferId=bd569279-37f5-4f5c-99d0-425873bb9a4b&dl=DYN365_ENTERPRISE_PLAN1&Culture=en-us&Country=us&flight=AdminOnCustomization&ali=1


Step 2 Click on 'Admin' 





















Step 3 Navigate to 'Admin Center'








































Step 4 Navigate to 'Dynamics 365'












































 Step 5 Select your CRM Instance and Click on Solution 'Edit'.


















 Step 6 Once your Portal is installed, Go to 'Application' tab and click on 'Portal Add-On' to configure Portal settings.



              


 Step 7  Select the Portal you want to install in your CRM instance and Click on 'Install'. and Wait until solution not get fully installed.
























Step 8 Enter below mentioned details to configure the Portal in your CRM instance.



Step 9 Hit Portal URL in browser.


You will be asked to login again and accept to provide certain permissions to access Dynamics 365 (CRM) and Office 365 data.


Step 10 Click Accept


Portal requires below permissions:

Read directory data – Allows the app to read data in your organization’s directory, such as users, groups and apps, without a signed-in user.


Enable sign-on and read users’ profiles – Allow users to sign in to the application with their organizational accounts and let the application read the profiles of signed-in users, such as their email address and contact information.

Go and have cup of coffee…Your CRM Portal is getting ready in few mins...   :)







Saturday, 24 December 2016

Use OData Query in ADXStudio

As we know Adxstudio Portal is now one of the most used Web Portal integrated with Dynamic CRM and one of the most common requirement and frequently asked question by developers is How to use retrieval query on Portal to fetch data from CRM.

One of the most common requirement on Portal is to auto populate data in entity forms fields based on lookup value.

For Example : As soon as user select customer in Customer lookup field, I want to auto populate selected customer entity data on case entity form fields (customer email, mobile phone, company name etc). Like this there might be so many requirement to fetch CRM data on portal conditionally.

Before going through the usage of OData in Adxstudio Portal first let us understand what is OData.

What is OData ?
OData is also referred as Open Data Protocol. Dynamic CRM mainly uses Windows Communication Foundation (WCF) data services framework to provide OData Endpoint which is nothing but a REST based data service. The address for the endpoint is:

https://{OrganizationRootUrl} /XRMServices/2011/OrganizationData.svc

How to use OData in Adxstudio Portal ?

I have been asked so many times for how to use OData Query in Adxstudio Portal,

Below are the steps to use OData query in adxstudio :-

Step 1 - Create Entity List in CRM with below mentioned configuration.

Name of Entity List, Entity Name, Website, View, OData Feed - Enabled,Entity Type Name, Entity Set Name, View





Step 2 -  Test OData.


Hit your portal url  on browser in below mentioned format.

<Portal Url>/_odata   -  This will give you all Entity list in which you have enabled OData Feeds.





Hit your portal url  on browser in below mentioned format.

<Portal Url>/_odata/<Entity Set Name>   -  This will give you the result of OData on browser.

Step 3 -  How to use OData in JavaScript (on Entity Form/Web Form/Entity List/Web Page/).


// Start Case Retrieval code

var GetResolvedCases = "~/_odata/cases?$filter=statuscode/Value eq 1";

or

var caseGuid = 'A237C638-F47B-E611-80F2-5065F38BF2F1';

var retrievebyGUID = "~/_odata/incidents?$filter=incidentid%20eq%20(guid%27" + caseGuid + "%27)";

$.ajax({
    type: "GET",
    url: GetResolvedCases,
    dataType: 'json'
}).done(function (json) {

    var CaseColl = json.value;

    // Get Case ticket number
    if (CaseColl[0].ticketnumber)
    {
        CaseId = CaseColl[0].ticketnumber;

    }
})
})

// Case Retrieval code End


Using above code you can get Case ticket number, if you are familiar with Dynamic CRM OData query then you can make query as per your requirement, or you can refer below link to know more about OData query syntax and uses.

Note : Refer below link for more details about how to write OData Query in CRM/Portal

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


Saturday, 1 October 2016

Subgrid Issue in ADXStudio


Here are some important points regarding subgrid behavior in ADXStudio :
  • You will not be able to see Subgrid or Subgrid record on entity forms if the form is in Create or Insert mode.
  • ADXStudio Subgrid behavior is same as CRM Subgrid, which show '+' icon above grid once you save the parent record.
  • Subgrid will not be render on your Entity Form until you will not pass Parent record guid in Query String as parameter in URL
  • Go to Redirect section of Entity Form(that is on Insert Mode) where you will find two options "or Webpage" and "Record Id Query String Parameter name".
  • Create a new webpage and also create a new entity form which will be same as above entity form but this entity form will be in Edit mode.
  • Attach this newly created Edit mode entity form with newly created webpage.
  • Now select this new webpage in "or Webpage" lookup of  your Insert mode Entity Form.
  • Write id in "Record Id Query String Parameter name" box.
  • Now you are done, as soon as you will submit the Insert mode Entity form, you will be redirected to newly created entity form (Edit mode) by passing its guid in query string.
  • Its bit complex, but this is the way how we can show Subgrid in Entity form which is in Insert Mode.

I had faced this issue and spent lot of days to sort out this issue, but finally i come up with above solution. Hope it will help someone to get rid of this issue.

Below are the settings required on ADX Entity form :



When the Entity form is in Insert mode Subgrid will be shown like this :


Subgrid on Entity Form :



Fig :URL of Entity Form on Portal in Insert Mode 


When the Entity form get Submitted Subgrid will be shown like this :















Fig :URL of Entity Form on Portal after submission 


Blogger Widgets