Archive
Show custom messages as banner notifications – CRM 2011
In CRM 2011, one way to show custom messages is using Jscript ‘alert’ function.
In one of our requirement we have to display a custom message on CRM form banner like OOB notification.
We can achieve this using Jscript, but it’s an unsupported way and there are no guarantees that this code won’t change in the future.
I am providing 2 scripts which is compatible Pre and Post UR 12.
Post UR 12
// Level – 1 (Critical), Level – 2 (Info), Level – 3 (Warning),
function addNotification(message, level) {
try {
var notificationsList = Sys.Application.findComponent(‘crmNotifications’);
if (notificationsList) {
notificationsList.AddNotification(‘noteId1’, level, ‘namespace’, message);
}
} catch (e) {
}
}
Pre UR 12
// Level – 1 (Critical), Level – 2 (Info), Level – 3 (Warning),
function addNotification(message, level) {
try {
var notificationsArea = document.getElementById(‘crmNotifications’);
if (notificationsArea) {
if (level == 1) { //critical
notificationsArea.AddNotification(‘mep1’, 1, ‘source’, message);
}
if (level == 2) { //Info
notificationsArea.AddNotification(‘mep3’, 3, ‘source’, message);
}
if (level == 3) { //Warning
notificationsArea.AddNotification(‘mep2’, 2, ‘source’, message);
}
if (message == “”) { // Clear the notifications
notificationsArea.SetNotifications(null, null);
}
}
} catch (e) {
}
}
How do I use the method
- To show custom message as Information, pass message and Level =2
addNotification(“This is sample message.”, 2);
Note – CRM 2013, has a new feature to display Notifications which is a supported way.
🙂
‘Selected record types not defined for connection roles’ – Error
In CRM, ‘Connections’ are relationships between two entity records in the system. It’s a way to create a relationship (link) between two entities records.
I got the below error when I try to connect one of my custom entity record with ‘Account’ by the role ‘Referred by’
Fix
We have to configure the entity type on the “Connection Role”, Referred by
- Go to ‘Advanced Find’ –> Connection Role
- Open the ‘Connection Role’, ‘Referred By’
- Choose the entity you want this ‘Connection Role’ work for
- Save and Close
🙂
Undefined Error – Activity Feeds CRM 2011
You might have experienced the below script error, when you click on ‘What’s New’ link on Sitemap
To fix this error, check if the logged in user has “Activity Feeds” security role or not.
“Activity Feeds” security roles comes, when you import the “Activity Feeds” managed solution in to your CRM application.
Every user other than ‘System Administrator’ should have “Activity Feeds” security role to view feeds.
Notifications using script – CRM 2013
CRM 2013 has a new feature to display notifications (i.e., Errors,Warnings and Information’s) like a banner message using JavaScript.
We can create both Form level notifications as well as Field notifications.
- Form notifications
- This method display notifications on the top of the record form.
Syntax – Xrm.Page.ui.setFormNotification(<Notification message>,’ ERROR\WARNING\INFORMATION’);
- Field notifications
Syntax – Xrm.Page.getControl(Field).setNotification(<Notification message>);
Observations
- The Save action happens even if you have form level error notifications
- The order of notifications are 1) Information notifications 2) Error notifications and 3) Warning notifications
- The banner only show 3 rows of notification, the user has to scroll down to see the other
- Use
Xrm.Page.ui.clearFormNotification()
to clear the banner notifications
Refer this link for more details
🙂
Legacy Feature Check Tool – CRM
The next major release of CRM (CRM 2013) is slated to release and will be dropping support for some of the legacy features.
The following legacy components that will not be supported in the next release:
- The 2007 web service endpoint from HTML\JavaScript web resources.
- Plug-ins and custom workflow activities built using the Microsoft Dynamics CRM 4.0 SDK.
- ASPX web pages in the ISV folder.
- The 2007 endpoint from external applications using IIS logs.
Legacy Feature Check Tool
- The “Legacy Feature Check Tool” tool scans the deployment (plug-ins, web resources, IIS logs, and more) and detects the legacy components.
- The tool is safe to run on production deployments and does not update or modify any data or configurations in the deployment
How to run the tool
- Open the CRM web server
- Copy the “LegacyFeatureCheck.zip” folder and extract
- Open the command prompt and point to the “LegacyFeatureCheck” folder
- Run the tool with the /? command-line argument to get the usage instructions
- To inspect one of my organization named “Venilla” for legacy features, run following command
Microsoft.Crm.LegacyFeatureCheck.exe /org:vanilla /out:log.xml
- It writes the log into ‘log.xml’, on the “LegacyFeatureCheck” directory
- The XML will be in below format with issue will be given in <VerificationResult> node
<DeploymentVerificationResults>
<Result>
<OrganizationName>***Deployment***</OrganizationName>
<OrganizationId>00000000-0000-0000-0000-000000000000</OrganizationId>
<Issues>0</Issues>
<Results />
</Result>
<Result>
<OrganizationName>Venilla</OrganizationName>
<OrganizationUniqueName>Venilla</OrganizationUniqueName>
<OrganizationId>f50b3196-b029-e311-bb69-00155db03129</OrganizationId>
<Issues>1</Issues>
<Results>
<VerificationResult>
<Severity>Warning</Severity>
<Component>PluginAssembly</Component>
<ComponentId>b7bed020-bed1-e111-83d9-0019b9f8f548</ComponentId>
<Message>
Assembly “Venilla.Crm.Workflow” with version ‘1.0.0.0’
references the CRM 4.0 SDK.
</Message>
</VerificationResult>
</Results>
</Result>
</DeploymentVerificationResults>
🙂
Plug-in on related entities during ‘Cascade All’ actions
Assume the relationship behavior between ‘Contact’ and ‘Appointment’ is “Cascade All” on ‘Assign’ action.
By virtue of that, if a Contact has 2 Appointments, if I change the owner of ‘Contact’ the related 2 Appointment owner also changes.
In one of the requirement, we have to restrict the Cascade operation based on business logic on child record (i.e., Appointment)
So I registered a Plugin on ‘Assign’ of ‘Appointment’ and want to handle the Cascade operation, but the Plugin never get executed.
Reason & Solution
- CRM treats Cascade Assign operation on Child records as an Update.
- Register the Plug-in on ‘Update’ instead of ‘Assign’ message.
- In the Update plug-in, the Target entity only contain ‘Owner’ field
🙂
CRM 2013 – Release Preview Guide
Next major version of CRM release, CRM 2013 is due to release in the fall of 2013.
The CRM 2013 “Release Preview Guide” highlighting some of the key investment areas is available.
Multiple forms of type Main are found. No Record Walls are added – CRM 2011 Activity Feeds Error
I was getting below warning message, when I tried to configure Activity Feeds for entity ‘Contact’ and selected the “Enable walls for this type of record form” check box
Multiple forms of type Main are found. No Record Walls are added. Configure the walls to the required forms manually
Reason
The reason was, my ‘Contact’ entity has multiple forms of type “Main” configured and CRM does not allow us to check “Enable walls for this type of record form” check box.
So to configure the walls for ‘Contact’ entity, we have to do it manually by following below steps
How to configure “Record Wall” to required forms manually
To configure wall manually
- Choose the form you need to show the record wall for among multiple forms
- Open the Form Editor
- Insert a new Tab with single column (Go to Insert > Tab > One Column)
- Open the Tab to edit (Go to Tab Properties > Display)
- Name= tab_recordwall
- Label = Record Wall
- Uncheck “Expand this tab by default”
- Tab Properties > Events
- Form Libraries, add “msdyn_/ActivityFeeds.Form.js” file
- In event handlers, Add
- Library: msdyn_/ActivityFeeds.Form.js
- Function: ActivityFeeds.Form.CustomizationUtils.updateRecordWallRenderingState
- Check “Enabled.
- Check “Pass execution context as first parameter”
- Save your changes to the tab and return to the form editor.
- Select the section inside of the “Record Wall Tab”.
- In the Form Editor, Add ‘RecodWall.htm’ file by click Insert > Web Resource
- In the “Record Wall” Tab’s ‘Section’, choose ‘General’ tab and set
- Web resource = msdyn_/RecordWall.htm
- Name = RecordWall
- Visible by Defualt = checked
- Pass record object…= checked
- In the “Record Wall” Tab’s ‘Section’, choose ‘Formatting’ tab and set
- Layout > One column
- Row Layout > 15 rows (this is flexible, but 15 is standard the standard look).
- Display border = yes
- Scrolling = as necessary
- Save & publish
🙂
Xrm.Utility is undefined error – CRM 2011
Other day when I deployed my solution on a new CRM server, I was getting “Xrm.Utility is undefined” script error.
I refered“Xrm.Utility” JScriptin my code to open forms which was causing script issue.
Reason & Fix
- The CRM server is not having UR 8
- Since Xrm.Utility object was added in CRM 2011 Update Rollup 8, installing UR 8 on server solved the issue
🙂
Merging solutions in CRM 2011
Imagine you have 2 developers (Dev 1 & Dev 2) in your team working on 2 different organizations and 2 solutions, at the time of every release, you need to merge the components of both developers in to 1 solution.
One way is
- Import Dev 1 & Dev 2 solutions in to another new organization.
- Create a new solution and add the components of both solutions manually
- This is easy if Dev 1 & Dev 2 solutions has less components.
What if the components are huge? you need to manually pick and add components both solutions in to a single solution or
Another way of merging solutions
- Export & Save the both Dev 1 & Dev 2 solutions
- Extract the saved solution .zip folders
- Open “Solution.xml” files in both solutions in a notepad
- In the <UniqueName> node, provide same unique name in both “Solution.xml” files
- Import them back to new a organization
- After the import, we get a new merged solution.
- This is easier way of merging if the solutions has lot of components
Refer below MSDN video for more details
🙂