Unsaved CRM changes – Visual representation in USD

The other day, when I’m in discussion with the #USDGuru – @ParkhurstNeil; He showed me his interesting approach to use these emoji icons to display on tabs. He mentioned something similar to this over here. That strikes me the thought – why can’t we use this as a Visual representation for Unsaved CRM Tab? And here you go – on the implementation steps.

GOAL: Display a start (🔯), whenever a Contact has been edited, unsaved and shifted to another tab – that represents the content in the Contact tab is not yet Saved.

NOTE:

🔯 – this is just an emoji I used for reference purpose. No hard feelings, you can choose any emoji of your choice. Just ask google  🙂

Chosen Contact tab for simplicity to write the post. You can use the same mechanism for any other CRM tab and for that matter for any other standard web application if they have a way of notifying/checking unsaved content.

This is just one simplest way of implementing this scenario. There are a lot of other possible & creative ways still exist with their own pros & cons. No need to stick to this implementation only.

STEPS: Don’t want to waste much time, let’s look at the steps involved

a) An action call to check form is dirty, if so – populate context sensitive variable with our emoji – 🔯

b) Attach action call to event – SelectedAppChanged

c) Alter the Contact hosted control’s display name to show the icon.

DETAILED STEPS:

a) Crete Action call with the following information.

Field Name Field Value Remarks
Name Verify If Contact is Dirty Any meaningful name of your choice
Order 10
Hosted Control Contact
Action RunXrmCommand
Data var icon=Xrm.Page.data.entity.getIsDirty()===true?”🔯”:””;
window.open(“http://uii/CRM Global Manager/CopyToContext?ContactDirty=”+icon);
Nothing fancy, Checking if the entity is Dirty, If so, Set Emoji Icon, if not make the icon as empty. The next line of code is however interesting – It says USD to call an action named “CopytoContext” available on “CRM Global Manager” with data as “ContactDirty=<<Icon>>”. This is how we normally pass notifications to USD from Client side scripting.
Condition CRMGlobalManager.IsAppLoaded(“contact”)===true This condition ensures that the action call fires only if the contact page is loaded in UI.
Action call to check Unsaved Changes in Contact

Action call to check Unsaved Changes in Contact

b) Attach action call to the event. Simply navigate to Unified Service Desk >> Events >> Search for “SelectedAppChanged” (Create one under panel layout, if you don’t find it in your configurations). Add the above action call to this event.

c) Modify the display name of Contact. Navigate to Unified Service Desk >> Hosted Controls >> Contact. Change the existing display name from [[contact.fullname]]-[[Contact.address1_city]] (if you are using OOB configurations) to [[contact.fullname]]-[[Contact.address1_city]] [[$Context.ContactDirty]] .

Contact Hosted control with Context variable to represent unsaved changes

Contact Hosted control with Context variable to represent unsaved changes

That’s it. Close and Re-open your USD, Modify some content in Contact, Shift focus to a different tab… voila …

Unsaved Changes in CRM Tab, Visual representation

Unsaved Changes in CRM Tab, Visual representation

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s