Attach images in KB in Dynamics 365

Attach images in KB in Dynamics 365

Attach images in KB in Dynamics 365

Scenario

To add images in knowledge article, we need to provide the image URL. In CRM we can add image as a web resource and we can get the URL of the image.

To achieve this, I have created a custom entity to create an image web resource

Entity Name : New_WebResource

Attribute Name Attribute Type
Name Single line of text
Image URL Single line of text –Format (URL)
Image Type Option set (PNG -5 , JPEG -6)
Image Description Multiple lines of text
base64_value Multiple lines of text

Step 1

Create a web resource with the type as html and add the below code. The below html will help you to upload the image and can get and set the base64 value of the uploaded image in “base64_value” attribute.

</p> <p><html><br /> <head><meta><meta><meta><meta><br /> </head><body style="overflow-wrap: break-word;"><br /> <input id="inputFileToLoad" type="file" accept="image/*" onchange="encodeImageFileAsURL();"></p> <div id="imgTest"></div> <p><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><br /> <script type="text/javascript"> function encodeImageFileAsURL() { var filesSelected = document.getElementById("inputFileToLoad").files; if (filesSelected.length > 0) { var fileToLoad = filesSelected[0]; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent) { var srcData = fileLoadedEvent.target.result; // <--- data: base64 var newImage = document.createElement('img'); newImage.src = srcData; document.getElementById("imgTest").innerHTML = newImage.outerHTML; window.parent.Xrm.Page.getAttribute("cmp_base64_value").setValue(document.getElementById("imgTest").innerHTML); } fileReader.readAsDataURL(fileToLoad); } } </script></body></html></p> <p>

Step 2

Open entity’s main form and add all the above attributes. Click on web resource in form editor and choose our web resource from step 1.

Step 3

Create a new web resource with the type of java script. Add the below code.

function getstring(context)
{
var type;
var textdescription=Xrm.Page.getAttribute('cmp_base64_value').getValue();
//checks the base64_value is null or not
if(textdescription ==null)
{
//if the uploaded file is not an image then the base64_value is null and shows the alert.
alert("please choose image file.");
var saveEvent = context.getEventArgs();
saveEvent.preventDefault();
}
if(textdescription != null)
{
//splitting the unwanted characters from base64_value, to get the exact base64 value of the image.
var removelast2character= textdescription.slice(0, -2);
var getbeforecomma= textdescription.slice(0, textdescription.lastIndexOf(","));
var format=getbeforecomma.split('/')[1];
var finalformat=format.split(';')[0];
var teste=removelast2character.split(',')[1];
if(Xrm.Page.ui.getFormType() == "1")
{
//Create web resource (custom entity)
if(finalformat=="png" ||finalformat=="PNG")
{
//Image type is PNG
var type=5;
create(type, teste);
}
else if(finalformat =="jpeg" || finalformat =="JPEG" || finalformat =="jpg" || finalformat =="JPG")
{
//Image type is JPG
var type=6;
create(type,teste);
}
else
{
//Image type is not equal to PNG (Or) JPG
alert("Record has not been published. Please select PNG (or) JPEG type image");
Xrm.Page.getAttribute('cmp_base64_value').setValue("");

var saveEvent = context.getEventArgs();
saveEvent.preventDefault();
//preventAutoSave(econtext);
}}}}

function create(type, base64str)
{
if(Xrm.Page.ui.getFormType() == "1")
{
//Creating web resource in Dynamics 365.
//Below is the url format of the web resource location. Change it for your CRM org.
var url="https://mastermind8.crm8.dynamics.com//WebResources/";
var imagedescription=Xrm.Page.getAttribute("cmp_imagedescription").getValue();
var name=Xrm.Page.getAttribute("cmp_name").getValue();
var nowname=name.split(' ').join('');
var bytevalue=Xrm.Page.getAttribute("cmp_base64_value").getValue();
var entity = {};
entity.content = base64str;
entity.webresourcetype = type;
entity.name = "new_"+nowname;
entity.displayname = name;
entity.languagecode = 1033;
entity.description = imagedescription;

var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/webresourceset", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
var uri = this.getResponseHeader("OData-EntityId");
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(uri);
var newEntityId = matches[1];
var nowurl=url+"new_"+nowname+"?preview=1";
Xrm.Page.getAttribute("cmp_imageurl").setValue(nowurl);
if(type=="5")
{
Xrm.Page.getAttribute("cmp_imagetype").setValue(5);
}
else
{
Xrm.Page.getAttribute("cmp_imagetype").setValue(6);
}
setTimeout(function () {Xrm.Page.data.entity.save(); }, 2000);
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
}
}

Step 4

Navigate to form editor click on Form Properties, add our library and in Event handler call the “getstring” function in “On Save” event of form. Select the check box “Pass execution context as first parameter.” Because we have used the context in our function.

Step 5

Save the form and then click on “Publish”. Navigate to Service sitemap and click on “Web Resources”.

Note: I have selected “Service” sitemap to display this entity (new_webresource).

Step 6

Create new. Upload JPG or PNG image and click on “Save”.

Step 7

After save, the URL of the image will be populated. Copy the image URL.

Step 8

Navigate to “Customer Service Hub” and click on “Knowledge Articles”. Create New. In Content area click on image icon and paste the copied Web resource URL from step 7, then click “OK”. Save this KB and publish it. Now it is visible in Knowledge article. We can refer this KB in case and it will show the KB text content and images.

Step 9

Open a new case and search this KB. It will show the KB content. We can attach this with our case for reference.

Happy CRMing..!

This article was written by Monika Sri

Reasons to Integrate Marketo with your business software

Reasons to Integrate Marketo with your business software

Reasons to Integrate Marketo with your business software

Marketo Integration

In today’s competitive world marketing is too important to be left only with the marketing team. Marketing is the core of any business and only innovative marketing could help in getting better ROI. Marketing software like Marketo has changed the way of marketing once and for all. Gone are the days where they were considered only to be sending Emails and simple marketing co-ordinations.Nowadays Marketo Integration helps in marketing to take them to new horizons.

What is Marketo Integration?

Marketo is an account-based marketing automation tool to help in managing combined sales and marketing efforts. The evolution of Marketo for more than a decade now has only benefited business in innovative marketing ways. Now integrating it into various other applications and systems bring in far better results than using it separately. They could be integrated by Bedrock data, the integration partner of Marketo.

What are the applications and systems Marketo could be integrated?

To facilitate marketing in an innovative and systematic way of integrating Marketo with business software is essential. They could be integrated without any further cost with the following applications for giving better marking strategies and solutions:

Reasons to integrate Marketo in business software

Integrating Marketo in business software could yield mind-boggling changes in the way of marketing of an organization. The major benefit of integrating Marketo with CRM could give right ROI for any marketing campaign. The continuous and constant monitoring of specific areas of interest of marketing benefits could help improve marketing for better ROI. The following are some reasons why Marketo should be integrated into business software:

  • To analyze the current trend and change the marketing campaign as per the trend for better results
  • Optimizing the efficiency of marketing by cloning many programs like e-mail, landing pages and others
  • Managing lead generation campaigns, e-mail marketing, and other lead nurturing activities
  • Evaluate marketing programs and their performance on a day to day basis
  • Providing qualified leads to the sales team at the right time for better marketing results
  • Closed-end reporting to evaluate the ROI any time of the marketing campaign
  • Tracking sales leads back to certain marketing strategies which were successful and replicating them in other areas of business
  • Data from Marketo integration will help in analyzing the demography and behavior of the qualified leads to make the prospects of the business
  • Integration of CRM with Marketo will enable a better seamless database connection. This leads to up to date and accurate data available for making professional marketing.
  • The leads can be aligned with the lead scores obtained by them through various metrics. This will facilitate following the important leads rather than the lesser ones. This could save time and be beneficial in finalizing the right ones at the right time.
  • A suitable marketing campaign could be created with the help of a lead database from Marketo with other sales tools.

Integrating Marketo with the business software ensures their success by sending the right message at the right time to the right people.

Integrating POP3/SMTP with Dynamics 365

Integrating POP3/SMTP with Dynamics 365

Integrating POP3/SMTP with Dynamics 365

How to integrate POP3/SMTP with Dynamics 365?

We can use server-side synchronization to synchronize Dynamics 365 with Gmail, Outlook, Yahoo, and other POP3 email servers.

POP3 – Sync yahoo incoming email with dynamics 365 email activities.

SMTP – Send email from dynamics 365.

Note, however, that you can’t synchronize appointments, contacts, and tasks with POP3 email servers.

Follow these steps to integrate Dynamics 365 to POP3/SMTP Servers.

Step 1

Yahoo Account

First Enable Less Secure Apps in your yahoo account.

  • Select your profile -> click Account Info -> Account Security
  • Allow apps that use less secure sign-in to Yes

Gmail Account

In Gmail to permit external access to the mailbox using POP3 protocol.

Click Settings > Forwarding and POP/IMAP tab.

In the “POP3 Download” section, select Enable POP for all mail (If you don’t want emails prior to now to be synced, then select Enable POP for mail that arrive from now on).
In When message is access with POP drop down list select archive Gmail’s copy and click Save Changes.

Enable Less secure Apps in your Gmail account.

Login into Gmail -> Select My Account in your Gmail profile -> Sign-in & Security -> Apps with Account Access -> Allow Less Secure apps to On

Hotmail Account

Login to your Hotmail account -> View all outlook settings -> Sync Email ->Enable POP to YES

Step 2

Go to Dynamics 365 instance →Settings → Email Configuration → Email Server Profiles → Click New Button → POP3/SMTP Server

In dynamics 365 instance Microsoft Exchange Online profile is created by defaults. So, we must create a new profile to configure POP3/SMTP servers (Yahoo, Gmail, and Hotmail) account with Dynamics 365.

Step 3

– Enter name of your profile.
– Enter incoming and out coming server location for your POP3/SMTP servers

Yahoo

  • Incoming Server Location : pop.mail.yahoo.com
  • Out coming Server Location : smtp.mail.yahoo.com

Gmail

  • Incoming Server Location : pop.gmail.com
  • Out coming Server Location : smtp.gmail.com

Hotmail

  • Incoming Server Location : pop3.live.com
  • Out coming Server Location : smtp.live.com

– In credentials section select Authentication type as Credentials Specified by a User or Queue
– Select same settings for Outgoing its set to YES

Step 4

Click Advance tab and enter the incoming and out coming port for your POP3/SMTP servers

Yahoo

  • Incoming Port : 995
  • Out coming Port : 587

Gmail

  • Incoming Port : 995
  • Out coming Port : 587

Hotmail

  • Incoming Port : 995
  • Out coming Port : 587

– Click Save & Close

Step 5

Settings → Email Configuration → Email Configuration Settings

In Default Microsoft dynamics 365 process the email using Email Router. We are configuring email with Server-side synchronization. So, select Server-Side Synchronization as process method

  • Select server profile as newly created server profile (Ex: Yahoo profile, Gmail profile)
  • Incoming Email: Server-Side Synchronization or Email Router
  • Out coming Email: Server-Side Synchronization or Email Router
  • Click Ok to save the configuration.

Step 6

Go to Settings → Email Configuration → Select mailbox to do configuration

  • Select Allow to Use Credentials for Email Processing to YES
  • Enter your User Name of your account (Ex: xyz@yahoo.com , xyz@gmail.com )
  • Enter password of your account.

Step 7

In Synchronization Method section change the following settings

  • Select your newly server profile(Ex: Yahoo profile, Gmail profile) in Server Profile Lookup
  • Incoming Email : Server-Side Synchronization or Email Router
  • Out coming Email : Server-Side Synchronization or Email Router
  • Click Save.

Step 8

  • Click Approve Email Button in ribbon.
  • Then click Test & Enable Mailbox, and in the popup window uncheck the check box [if it is checked] and click Ok.

Then the email processing its start. It takes few minutes to validate the configuration. Few minutes later Incoming and Out coming Email Status is change to Success.

This article was written by Yogeswari KJ

How to track read/unread emails in Dynamics CRM

How to track read/unread emails in Dynamics CRM

How to track read/unread emails in Dynamics CRM

Dynamics CRM does not have a provision to track read/unread emails. So we have to do customization to track the email status.

Business Logic

Create a two-options type field (custom field) in email entity. The values must be “Yes” and “No” and the default value of the custom field must be “No”. When user opens the incoming email the custom field value is changed to “Yes”.

Follow this steps to track read/unread emails.

Steps 1

First create a two-option type field in Email entity.

Ex:

Custom attribute name: new_emailreadstatus – Values “Yes” & “No”. Default value is set to “No”

Steps 2

Create new webresource (JavaScript) in Dynamics CRM and copy and paste the below code in webresource.

Code

function setreadstatusemail ()
{
// Check form type is “Update”, because when user opens the existing email in CRM, the form will go in an “Update” form type.

if (Xrm.Page.ui.getFormType() == “2”)
{
var statuscode=Xrm.Page.getAttribute(‘statuscode’).getValue();

// we can track read and unread status for incoming emails only. In CRM incoming emails are in “Received” statuscode. So we have to check whether the statuscode of the email as “Received”.
//In CRM the “Received” statuscode values is “4”.

if(statuscode==”4″)
{
var stringstatus=”No”;

// Replace your custom attribute name
var emailreadstatus=Xrm.Page.getAttribute(new_ emailreadstatus).getText();
alert (emailreadstatus);

// check the emailreadstatus values is equals to “No”. So the email in unread status.
if(emailreadstatus==stringstatus)
{
alert (“Unread email”);

var emailid = Xrm.Page.data.entity.getId();
var updatedemaild=emailid.substr(1).slice(0, -1);

// whenever we try to update the new_emailreadstatus attribute in email entity, by default the form will be in read only mode.
// In CRM Received emails are in Read Only mode. We can’t update anything in the form.
// So first change the email statuscode to “Draft” and email status to “Open” then update the new_emailreadstatus value to “Yes” and again change the email statuscode to “Received” and email status to “Completed”
// using XMLHttpRequest, change the status of the email to “Open” and statuscode to “Draft”.

var entity = {};
entity.statecode = 0;
entity.statuscode = 1;
var req = new XMLHttpRequest();
req.open(“PATCH”, Xrm.Page.context.getClientUrl() + “/api/data/v8.2/emails(” + updatedemaild+ “)”, true);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
req.onreadystatechange = function()
{
if (this.readyState === 4)
{
req.onreadystatechange = null;
if (this.status === 204)
{
//Success – No Return Data – Do Something
//Set new_emailreadstatus as “Yes” in customfield.
Xrm.Page.getAttribute(‘new_readunread’).setValue(1);
// Then change the email status code to “Received” and status to “Completed”
changestatuscodetoreceived(updatedemaild);
}
else
{
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));

}
if(status==”true”)
{
Alert (“Email already read”);
}
}
}

}
function changestatuscodetoreceived(updatedemaild)
{
// use XMLHttpRequest to change the email statuscode to “Received” and status to “Completed”
var entity = {};
entity.statecode = 1;
entity.statuscode = 4;

var req = new XMLHttpRequest();
req.open (“PATCH”, Xrm.Page.context.getClientUrl() + “/api/data/v8.2/emails (” + updatedemaild+ “)”, true);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
req.onreadystatechange = function()
{
if (this.readyState === 4)
{
req.onreadystatechange = null;
if (this.status === 204)
{
//Success – No Return Data – Do Something
Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
}
else
{
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
}

Step 3

Call the webresource in onload event of email entity. Save and publish the customizations.

Step 4

After publishing open the Received email the new_emailreadstatus is changed to “Yes”.

This article was written by Yogeswari KJ

The growing importance of Business Intelligence

The growing importance of Business Intelligence

The growing importance of Business Intelligence

“Knowledge is past and intelligence is present” is an adage which squarely applies to today’s digitalized business world. In this competitive world business intelligence alone could make businesses successful. Business intelligence is a technique of transforming the collected data into information. CRM or customer relationship management is an effective business intelligence form for better results of the companies. Microsoft business intelligence or MSBI is a modern technique for successful business development.

MSBI tools

The following are the Microsoft business intelligence tools that could form an organization’s database for analyzing and transforming them into actionable information for their development.

  • SQL server data tools or SSDT
  • SQL server integration systems (SSIS)
  • SQL server analysis services (SSAS)
  • SQL server reporting services (SSRS)
  • Business intelligence development studio
  • Database management systems
  • Extracts, Transforms Load Tools (ETL)

How business intelligence help business development

Data and the tools to analyze them are out in the open in this digitalized business world. It is the business intelligence which acquires these data and stores them in a database for analyzing them in the right way to take companies to the next level. It should be the fundamental and integral part of any business for major improvements and sustenance in the future.

Importance of business intelligence

Even without the help of IT staff or other help multiple areas in an organization like sales, finance, customer satisfaction is benefited by business intelligence. They include:

Human Resource

A track of the employee’s ability, productivity, performance, scores, utilizing technological tools, payrolls, satisfaction levels and many more could be done with HR BI dashboards.

Customer Satisfaction

Demand and supply trends among the target audience, analyzing consumer trends, consumer behavior, formulating a business plan or strategy, production, manufacturing, budgeting and many could be enhanced with business intelligence. Also, it improves the relationships between businesses and customers.

Finance

Tracking budgets, visual insights into financial data, overall business health, potential problem areas and many more could be helped with business intelligence for taking a financial decision which could frame the future of the companies.

Boost ROI

For any company, the return of investment is the sole purpose for business. This could be well boosted with the business intelligence by the strategic awareness of the following:

  • Insight into the workings
  • Trends & analytics of the business process
  • Faster reporting
  • Lowering the operating costs
  • Manufacturing the products as to the requirements of the consumers
  • Effective working of the business process
  • Managing day to day efficiency
  • Sales deal conversion metrics
  • Enterprise-wide deployments

Sales

For companies to visualize sales cycle, display conversion & churn rates, total revenue, tracking the pipeline and many more will improve the performance of the sales to new levels which is the need of any company for its better future.

Reduce risks

Enables access to details and analytics about the businesses to identify risks which are not efficient for the growth of business and make informed decisions.

Marketing

Enhances tracking engagement, performance, trends, cost per lead, website traffic, and analytics of all marketing campaigns.

Business intelligence is the need of the hour for any organization for sustaining in this digitalized competitive business world.