Archive
ADX Portals 7.x – ‘Page_Validators’ is undefined
Other day, while adding a custom validator using JScript on an Entity Form, I was getting ‘Page_Validators’ is undefined error, at below line of code.
// Add the custom validator to Web Page’s validators array
Page_Validators.push(spouseValidator);
Reason:
- The dynamics CRM form, associated to the ADX Entity Form, does’t have any required field, hence ‘Page_Validators’ array is NULL as ADX did’t need to load any validators.
Fix:
- ‘Page_Validators’ is a validator collection and we dont have control over this.
- Below workaround worked for us:
- Make one of the field as ‘Required’ by adding ‘Entity Form Metadata’. ADX instantiates ‘Page_Validators’ array, as there is Required field now.
- You can make the field as Non-required in the JScript.
Note:
- This behavior is fixed in further versions of ADX and Dynamics Portals.
đ
ADX/Dynamics Portals Issue – Missing Entity ‘Tab’ in ‘Web Form Step’
We have ADX portal 7.0 solution installed on our Dynamics 365 8.2 application. We got a requirement to create a Web Form steps on a Custom Entity ‘Employee’.
‘Employee’ entity has an OOB ‘Information’ of ‘Form Type’ Main, with a tab named ‘Personal Details’.
Issue:
- While adding a Web Form step, there was no ‘Personal Details’ tab and could get only ‘general’ tab.
- In the new ‘WEB FORM STEP’, select the ‘Form Name’
- In the ‘Tab Name’ drop down, there is no ‘Personal Details’ tab and all it had was ‘general’ tab.
Reason:
- As there were 2 OOB forms (i.e., Form Type ‘Main’, ‘Mobile – Express’) with the same name ‘Information’, ADX solution always picking ‘Mobile – Express‘ form which had a tab ‘general’
Fix:
- Renamed ‘Information’ Main form to ‘Employee’.
- Publish the solution
- Refresh the ‘Web Form Step’ and you should see ‘Personal Details’ tab once you select the ‘Employee’ form.
đ
ADX/Dynamics Portals – Date field custom validation using JScript
Other day, In one of our Portal Web Form step, we got a requirement to validate ‘Date Of Birth’ where the value should not be the future date.
We can achieve this by adding a custom validator using JScript and register in your ‘Web Form Step’.
Below is the JScript code snippet which you need to paste in your Web Form Step’s ‘Custom JavaScript’ control.
Note:
- In below script replace the ‘new_dateofbirth’ with your field’s schema name.
- ‘new_dateofbirth_label‘ is the label of the DOB field on your Web Form Step.
$(document).ready(function () {
try{
if (typeof (Page_Validators) == ‘undefined’) return;
// Create new DOB validator
var dobValidator = document.createElement(‘span’);
dobValidator.style.display = “none”;
dobValidator.id = “dobValidator”;
dobValidator.controltovalidate = “new_dateofbirth”;
dobValidator.errormessage = “<a href=’#new_dateofbirth_label’>Date of birth should be in past.</a>”;
dobValidator.validationGroup = “”;
dobValidator.initialvalue = “”;
dobValidator.evaluationfunction = function () {
var dobValue = $(“#new_dateofbirth”).val();
var dob=new Date(dobValue);
var today = new Date();
if (dob > today) {
return false;
}
return true;
};
// Add the dobValidator to Web Page’s validators array
Page_Validators.push(dobValidator);
// Attach event handler of the validation summary link
$(“a[href=’#new_dateofbirth_label’]”).on(“click”, function () {Â scrollToAndFocus(‘new_dateofbirth_label’,’new_dateofbirth’);});
}
catch(e)
{
alert(“Error during DOB validation – “+e.description);
}
});
- Save the Web Form Step and test in portal.
- If you try to save DOB with future date. It shows warning in the banner as below:
- Click on the message and it will take you to the DOB control.
Refer my other article to get familiar with Portal syntax’s.
đ
Dynamics Portals – Entity List – Configure custom view names
With the Dynamics Portals ‘Entity List’, its easy and seamless to port the Dynamics entity views to Portal.
In below screen, I configured ‘Active Contacts’ and ‘Inactive Contacts’ views in my Entity List and if you notice, the view names are defaulted to Dynamics view names (i.e.,Active Contacts, Inactive Contacts)
What if we have to show custom labels for views in portal? its simple
- Open ‘Entity List’ form from your Dynamics application
- Views -> Advance settings
- Set your desired text in ‘Display Name’ field
- Save
- Go to Portal and refresh the Entity list web page
đ
Dynamics Portals â SaaS â Refer helper files in Web Templates
In my portal, I got a requirement to build a âSearch Screenâ, which pulls the data from CRM and render the results.
To achieve this, I configured a âWeb Templateâ with âSearch Screenâ using HTML and decided to use Data Tables table control to bind the results.
The challenge is, to use âData Tableâ control, I must refer the helper files (i.e., datatable.min.js, jquery.datatable.css) in my ‘Search Screen’ Web Template.
One way to solve is to copy the content from the helper files (i.e., datatable.min.js, jquery.datatable.css) and paste within the Web Template. This is a crude way as the single Web Template size enormously grows and would become unmanageable.
Optimal way:
- Create a separate Web Templates for Helper files (i.e., datatable.min.js, jquery.datatable.css)
- Make sure you wrap the script file’s content in <script> tag, while pasting to Web Template.
- Make sure you wrap the style sheet (i.e., css) files content in <style> tag, while pasting to Web Template.
- Refer the helper file Web Templates in the âSearch Screenâ Web Template.
- Syntax is {% include ‘Your helper file Web Template Name‘ %}Â
Notes:
- Using Web  Files is one approach but you cannot attach JScript file to your Web File as the .js file extension is restricted.
đ
Dynamics Portals – How to get the configured Portalâs URL
There was a question posted in my blog on how to get the configured Portalâs URL as someone else configured the portal.
Below are the steps to get your Portal URL.
From your Dynamics 365 Instance:
- Connect to your Dynamics 365 instance
- Navigate to Portals -> Website Bindings
- Open the record and read the URL from âSite Nameâ field
From your Dynamics 365 Admin Center:
- Connect to your âDynamics 365 Admin Centerâ (i.e., Login to Portal.office.com)
- Select your âDynamics 365â instance
- Click on âApplicationsâ tab
- Select âPortal Add-onâ and click âMANAGEâ button
- You would be redirected to âPortalâ configuration page
- Copy the URL
Note:Â You can access your Portal configurations page, only if your Admin granted access to your login Account. If you donât have permission, you would end up getting below error message:
You donât have permission to perform this action. Contact your global administrator to get owner permission for Application ID
đ
Dynamics 365 Portal â Troubleshoot errors hosted in Azure
Recently we got internal server error while we were accessing Portal hosted in Azure.
Microsoft Azure is providing simple and quick way to troubleshoot the errors.
There are few options to troubleshoot like âLog Streamâ and âDiagnostic Dumpsâ. In this Article, I am going to show how to use them.
Pre-requisite:
- Connect to your Azure account and open the Web App from âApp Servicesâ
- Make sure you enable âApplication Loggingâ from âDiagnostics logsâ section
Log Stream:
- ‘Log Stream’ is helpful to track the ongoing exceptions and track the live Request and Response.
Diagnostic Dump:
- Connect to KUDU services by clicking on âAdvanced Tools –> Goâ
- Click on Tools –> Diagnostic Dump
- Download and extract the .zip folder
- Go to ‘LogFiles’
- Open the âeventlog.xmlâ using any file editor
‘Application Insights’ is another option which helps you detect and diagnose quality issues in your web apps and web services.
đ
ADX Portal – Configure views to fetch Logged In Partner owned records
As we know, ADX portal would be accessed by external Partners and they get created as Contacts in the CRM.Â
We got a requirement to configure âMy Opportunitiesâ view in Portal to show the Opportunities owned by logged in Partner.Â
In CRM, this type of requirement is straight forward as the filter will be âOpportunity.owner=Logged in Userâ
How to configure similar view in Portal, as the Partner will be âContactâ?Â
When you Install/Enable Portal solution in CRM,
- It creates below Contact records.Â
- Also it adds a new field âPartner Ownerâ (i.e., msa_partneroppid) in all OOB entities.
To configure âMy Opportunitiesâ view in ADX:Â
- Choose âPortal Customerâ as filter criteria. This would be replaced with logged in partner.
- Create the view and configure as âEntity Listâ and publish to ADX.
đ
The specified organization already has an active Website Binding for this site – Dynamics 365 Portals
We have 2 Portal solutions (i.e., Partner Portal and Custom Portal) enabled in our CRM organization and when I tried to configure âCustom Portalâ in a Web App, I could not, as the “Adxstudio Portals Website” drop down was disabled and defaulted to âPartner Portalâ.
Reason:
- âPartner Portalâ solution configured first, and it created a record in âWebsite Bindingsâ.
- As design, portals defaults to âPartner Portalâ solution, if there was an active Website Binding.
Fix:
- Go to the âWebsite Bindingsâ in CRM, by navigating to âAdvance Find -> Website Bindingsâ.
- Delete the website binding record
đ
ADX Web Site Compilation Error – The type âSystem.Objectâ is defined in an assembly that is not referenced.
Recently while compiling my ADX web site, I was getting below compilation exception from all my .ascx (Views) files.
Compiler Error Message: CS0012: The type âSystem.Objectâ is defined in an assembly that is not referenced. You must add a reference to assembly âSystem.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aâ
Issue was bit strange as I already had âSystem.Runtimeâ dll referred in the website
Fix:
- Open the Web.config file and add below tag inside the <compilation> tag
<assemblies>
<add assembly=”System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
</assemblies>
- Your <compilation> tag should look as below
<compilation debug=”true” targetFramework=”4.5″>
<assemblies>
<add assembly=”System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
</assemblies>
</compilation>
Note:
- If your <compilation> tag already had <add assembly=ââŠâ> tags, add only <add assembly=”System.RuntimeâŠ> tag to the existing tags.
đ