Hi, Are you trying to set any field using javascript in account form which is not able to retrieve/set the value of the lookup? Sometimes this blank pop-up comes when the javascript code which retrieves the values using retrievemultiple and the result returns 0 records and the same gets assigned to any of the lookups. These type of error does not show any message but a blank pop-up as it is using callback function i.e. REST call. If found useful, pleas mark this answer as verified.
↧
Forum Post: RE: Blank dialog pop-up error shows randomly whenever accessing to and from "Account" entity
↧
Forum Post: RE: StringMap attributes in CRM 2011
Hi, Stringmap holds the optionset values and labels of an environment. If you have applied some changes to optionset by importing solution in Production, it is going to update Stringmap. If the customizations are applied by exporting it from dev, then the same customizations should also exist in Dev environment too. If you can share more details, we will be able to share possible solutions. If found useful, pleas mark this answer as verified.
↧
↧
Forum Post: RE: {"Object reference not set to an instance of an object."} Dynamics 365
Hi, You can use plugin profiler but it will not give you exact error in your query. IWe think there is some issue with blank field. Can you also check if the fields like aest_designationstatus and aest_expirydate are not null. If found useful, please mark this answer as verified.
↧
Forum Post: Dynamics 365 Build Tools is disabling my plugin steps
Hi, I'm doing my solution deployment using this Dynamics 365 Build Tools. Upon deploying all the Steps that are included in my solution has been disabled. Why does this happen? Can configure something to stop the disabling of the steps?
↧
Forum Post: RE: Updating certain entities throws error about not being able to update
Hi, Please check the user role with which you are trying to update the record. check if the attribute you are trying to update is not a system attribute which cannot be updated. Check if the type casting is done appropriately. Please check the link which talks about deprecated messages: docs.microsoft.com/.../dn932124(v=crm.8) If found useful, please mark this answer as verified.
↧
↧
Blog Post: What is Microsoft Dynamics 365 for Customer Service?
Microsoft Dynamics 365 for Customer Service is an application within the Microsoft Dynamics 365 universe that helps you to “earn customers for life” . When you want to differentiate your brand by using built-in intelligence that helps you deliver faster, more personalized service, and adds value to every interaction, Microsoft Dynamics 365 for Customer Service is worth looking into … The application offers many key benefits, which Microsoft breaks down into the following … Engage with your customers through multiple channels Utilization of this application allows users to create effortless support experiences. It’s easier to find answers through the self-service, community, or social channels, and users can intelligently route cases from any of these. The application helps your customer service agents focus on “high value” interactions, white automated artificial intelligence handles less pressing cases. Predictive care keeps customers happy and helps agents avoid service and support issues through the power of connected data and devices. Warning signs appear before a problem occurs so agents can prevent them from ever happening … Provide Quick and Personalized Support Microsoft Dynamics 365 for Customer Service helps guide agents to optimal outcomes using intelligent automation, surfacing relevant information at the right time in a single interface. Personalized service is delivered through the application with a complete customer view. Agents can focus on the tasks they need to while allowing AI to run automated processes they don’t need their hands in as much. Agents can clearly see more opportunities to cross-sell and upsell by having access to machine learning-driven recommendations. Image Courtesy of Microsoft Dynamics 365 for Customer Service Learn from Customer Interactions Users utilizing direct survey feedback, discussion forums, and social listening tools within the application have the opportunity to improve their service techniques more effectively, turning key insights into actions. By using this application, your team can onboard new members much faster and with more efficiencies. Customer service agents are able to move more quickly and easily with this application, optimizing staff levels and allocating resources based on trends in their data. Finally, as like with the rest of the Microsoft Dynamics 365 applications, this one allows for innovation, letting you adapt as an organization more quickly and invest in your technology with confidence. Uniquely, this application will help you to unify your service environment to automate processes and use third-party systems to have better customer engagement experiences. Since you, your team, and your organization is unique, how you specifically work within it will be different than another organization, though the general framework, as described above, remains true. The possibilities are expansive, and exciting with Dynamics 365 for Customer Service. If you want to learn more about Microsoft Dynamics 365 as a whole, join us for our next user group webinar. Click here to register. To start your journey with Microsoft Dynamics 365, reach out to our experts here for help. Before you select any technology, whether CRM, marketing automation, or something else, we at Ledgeview always advise that you conduct a thorough business analysis first. What works for your organization will be unique to your team and your business needs. We are eager to help you take your business to the next level of success we know you’re capable of.
↧
Blog Post: What is Microsoft Dynamics 365 for Talent?
Microsoft Dynamics 365 for Talent is a Microsoft Dynamics 365 application that helps leadership hire, develop, and retain quality people. Microsoft says the application “empowers your HR team and managers with the tools they need to land top candidates and accelerate their success” . They help break the benefits and its inner workings into the following sections: Hire Quality Candidates More Quickly The application lets you customize your talent sourcing, recruiting, and selection process. It enables users to give their entire hiring team access to a candidate’s profile through the power of the application and the connected tool, LinkedIn Talent Solutions. The application helps hiring managers to be transparent with their candidates from the get-go, to prevent wasted time and help them focus on the best candidates. Furthermore, this helps hiring managers to take ownership of the hiring process from the start of the recruitment journey. Hiring managers can take advantage of valuable tools like candidate profiles, assessments, interviewer assignments, mobile feedback, and more. Image courtesy of Microsoft Dynamics 365 for Talent Enable Employee Success Microsoft Dynamics 365 for Talent helps hiring managers “elevate” the onboarding process. In the application, they can store and use onboarding checklists, clearly defined processes, and timelines that help them get their jobs done better. The application leads to hiring managers being able to play to an employee’s strengths, helping them to make a greater impact on the company and its culture in a short amount of time in highly positive ways. Microsoft Dynamics 365 for Talent helps new employees become acclimated more comfortably, providing tools like campus maps, social opportunities, transportation options, and more, to help them get to know their colleagues and new environments easier. This is especially useful for employees who are entering a work culture from new territories outside of the local vicinity. Key performance indicators are outlined within the system to help hiring managers to monitor the success of talent and help talent to do the same. Users can create guides as templates for specific roles to keep expectations top of mind. Encourage Employee Growth Today’s workforce values opportunities to grow their skill sets. Dynamics 365 for Talent helps you expand this value by letting you track your team members’ accomplishments, ensuring they obtain the proper certifications. Dynamics 365 for Talent also lets you tailor experiences by role so that learning tracks are specific to each individual. Within the application, you can outline the skills and competencies needed for advancement and promotions that are all based on the individual’s current place within the company. Increase employee retention with the beneficial educational tools offered in this application. Increase Performance Standards Dynamics 365 for Talent helps you reward top-performers by “turning performance into a two-way conversation” from employee to manager. Help your employees manage their goals and your goals for them within this application. You can also conduct collaborative performance reviews within it that provide valuable opportunities for feedback, helping to shape individuals’ career paths. The application is a comprehensive resource for hiring managers that allows you to drive operational excellence and impact as an organization! On top of all of the benefits mentioned, the application also helps users to maximize strategic impact, centralize employee profiles, minimize compliance risk, and gather team member (people) analytics. The possibilities are expansive, and exciting with Dynamics 365 for Talent, especially for today’s HR Managers. If you want to learn more about Microsoft Dynamics 365 as a whole, join us for our next user group webinar. Click here to register. To start your journey with Microsoft Dynamics 365, reach out to our experts here for help. Before you select any technology, whether CRM, marketing automation, or something else, we at Ledgeview always advise that you conduct a thorough business analysis first. What works for your organization will be unique to your team and your business needs. We are eager to help you take your business to the next level of success we know you’re capable of.
↧
Forum Post: RE: Using Site Map Default Area Icons on New Area
Hi, Please refer to the following link for more details: community.dynamics.com/.../editing-sitemap-in-dynamics-365 If found useful, please mark this answer as a verified answer.
↧
Forum Post: KB Article CSS styling between backend and exposed portal front-end when published help
Hi all, I'm trying to setup some overarching CSS styles for KB articles published onto Portal. I noticed a few strange things as we're also migrating the KB articles from another source complete with all their HTML and HTML tags. Some of the migrated articles has CSS added inline within the HTML tags themselves (they were added in the CRM via the Customer Service HUB>Knowledge Articles) whilst others reference off a external style sheet. As they were going consolidate the styles I was looking to add in the external style sheet classes into the bootstrap css file in Dynamics and just have published articles inherit that style on the Portal front end. This seems to work except when inline CSS is added to the HTML of the KB articles via the Customer Service Hub after which the inline CSS takes precedence over the bootstrap portal styling. My question is: - Is there a way to override the inline CSS styling within the created KB articles. - What's the best method of getting a uniformed CSS style across all KB articles published to the portal. Should I be editing the default CSS of the portal? Kind regards, Mike
↧
↧
Forum Post: Product integration from Dynamics Sales(CRM) to Dynamics 365 Finance and Operation using CDS
Hi All, I want to make product integration between dynamics crm products to dynamics 365 finance and operation product using CDS. There is no template available for sales to fiance&operation for product so is there any way to create custom template for the same. Any help would be appreciated. Regards, Shahbaaz
↧
Forum Post: RE: MSC CRM 2015 impact of knowledge base on the performance
No direct way of finding the size of a particular article(s) in Dynamics. As it stores everything in database you can check the size of table however if there are attachments then it will be stored in a different table.
↧
Blog Post: Dynamics CRM – Online Product Ordering Portal
Dynamics CRM - Online Product Ordering Portal – US$2,850 only Impressive product ordering portal with payment gateway. Try this template: https://do.microsoftcrmportals.com Just US$2,850 fully configured Test Credit Card Account Number AMEX - 370000000000002 www.DynamicsObjects.com https://www.crmsoftwareblog.com/wp-content/uploads/Portal-Template-S.mp4 The post Dynamics CRM – Online Product Ordering Portal appeared first on CRM Software Blog | Dynamics 365 . Related posts: Dynamics CRM Portals – Design, Drag and Drop, Don’t Dig Deep on Development! Looking for Customer Portal for Microsoft Dynamics CRM? Microsoft CRM Voice of Customer integrated with Dynamics Portals
↧
Forum Post: RE: iOS speech to text now a voice memo?
Hello John, I tried this on my iPhone, its seems if you check the microphone icon then it will create a voice memo.wav file and attach it with notes. If you want good old "Speech to text" then just goto a notes Title or Details text box and when keypad appears then click microphone icon on keyboard.. this will now allow you to type by voice. More details on this page. community.dynamics.com/.../feature-enhancements-to-notes-in-dynamics-365-for-phones-and-tablets Hope this helps,
↧
↧
Forum Post: RE: Field Service Schedule Board not working with unified interface disabled?
Hello, You could try some of these possible fixes - www.daymandynamics.com/schedule-board-health-check-and-possible-fixes
↧
Forum Post: RE: Field Service Schedule Board not working with unified interface disabled?
Hi there, Microsoft is moving forward with the unified interface, so the web interface has/will become legacy. The schedule board is an example of this development. It is optimized for the unified interface.
↧
Forum Post: RE: Updating certain entities throws error about not being able to update
Hi "The entity cannot be updated" - you can also see this message if you are trying to update an entity that is in a read only state such as an Invoice or Case that has been closed or a Lead that has been qualified etc. In this case you want to check the statecode and statuscode attributes and make sure that the entity you are trying to update is not in an inactive state.
↧
Forum Post: RE: addCustomFilter - How to filter with operator 'in' where value is an array of objects
It looks like you are missing the end tag for the condition-tag. Try adding the right before you close the filter tag
↧
↧
Forum Post: Dynamics 365 9 OnPremise Invalid character when loading My Apps.
Problem: After upgrading to Dynamics 365 9.0 Onprem (version 1612 (9.0.4.5) (DB 9.0.4.5) local when loading the "My Apps" page (Shows model driven apps) we get an error "Crash Report" in all browsers ex. (Chrome, IE 11). Problem is for all users including including users with the System administrator security role. Have you experienced this as well? Invalid character CrmSymbols.woff (1,5) Chrome error: CrashReport: FileName:/Webresources/msdyn_/AppManagementControl/css/CrmSymbols.woff LineNumber:1 Function:anonymousror:Invalidorunexpectedtoken ErrorReport: 1.0 Uncaught SyntaxError: Invalid or unexpected token 1 /Webresources/msdyn_/AppManagementControl/css/CrmSymbols.woff /Webresources/msdyn_appmanagementcontrol anonymousror:Invalidorunexpectedtoken SyntaxError: Invalid or unexpected token anonymousror:Invalidorunexpectedtoken Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36 undefined undefined undefined 1920x1200 Web Online 2019-06-04T11:52:12 Internet Explorer 11 Error: CrashReport: FileName:/Webresources/msdyn_/AppManagementControl/css/CrmSymbols.woff LineNumber:1 Function: ErrorReport: 1.0 Invalid character 1 /Webresources/msdyn_/AppManagementControl/css/CrmSymbols.woff /Webresources/msdyn_appmanagementcontrol Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko en-US hu sv-SE 1536x960 Web</Cl
↧
Forum Post: RE: Bonus Rollup field
Rocker, thanks for the response. Is there a plugin you know that would do this or do we need to get one written specifically?
↧
Forum Post: Is it possible to generate OOB report as pdf format on button click of a custom entity
I have written the code as given below but it is not working //Author: Arunav Dash //Description: Creating Email and notes with attachment PDF var base64 = null; function form_onsave(executionContext) { debugger; var formContext = executionContext.getFormContext(); // if (formContext.getAttribute("ccc_senttocustomer") !== null && formContext.getAttribute("ccc_senttocustomer") !== undefined) // { // var senttocustomer = formContext.getAttribute("ccc_senttocustomer").getValue(); // if (senttocustomer === true) { // createAttachment(); // } // } createAttachment(); alert("Report Send Successfully"); } function getReportingSession() { var reportName = "Report Test.rdl"; //set this to the report you are trying to download //var reportGuid = "170faa66-19ad-e811-a96f-000d3af43d1a"; //set this to the guid of the report you are trying to download var reportGuid = "2B5A0201-D382-E911-A973-000D3AF06590"; //set this to the guid of the report you are trying to download var rptPathString = ""; //set this to the CRMF_Filtered parameter var selectedIds = Xrm.Page.data.entity.getId(); var pth = Xrm.Page.context.getClientUrl() + "/CRMReports/rsviewer/reportviewer.aspx"; var retrieveEntityReq = new XMLHttpRequest(); var strParameterXML = " "; retrieveEntityReq.open("POST", pth, false); retrieveEntityReq.setRequestHeader("Accept", "*/*"); retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); retrieveEntityReq.send("id=%7B" + reportGuid + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false&p:CRM_im360_recurringprocess=" + strParameterXML); var x = retrieveEntityReq.responseText.lastIndexOf("ReportSession="); var y = retrieveEntityReq.responseText.lastIndexOf("ControlID="); // alert("x" + x + "y" + y); var ret = new Array(); ret[0] = retrieveEntityReq.responseText.substr(x + 14, 24); ret[1] = retrieveEntityReq.responseText.substr(x + 10, 32); return ret; } function createEntity(ent, entName, upd) { var jsonEntity = JSON.stringify(ent); var createEntityReq = new XMLHttpRequest(); var ODataPath = Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc"; createEntityReq.open("POST", ODataPath + "/" + entName + "Set" + upd, false); createEntityReq.setRequestHeader("Accept", "application/json"); createEntityReq.setRequestHeader("Content-Type", "application/json; charset=utf-8"); createEntityReq.send(jsonEntity); var newEntity = JSON.parse(createEntityReq.responseText).d; return newEntity; } function createAttachment() { var params = getReportingSession(); if (msieversion() >= 1) { encodePdf_IEOnly(params); } else { encodePdf(params); } } var StringMaker = function () { this.parts = []; this.length = 0; this.append = function (s) { this.parts.push(s); this.length += s.length; } this.prepend = function (s) { this.parts.unshift(s); this.length += s.length; } this.toString = function () { return this.parts.join(''); } } var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function encode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; while (i > 2; enc2 = ((chr1 & 3) > 4); enc3 = ((chr2 & 15) > 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)); } return output.toString(); } function encodePdf_IEOnly(params) { var bdy = new Array(); var retrieveEntityReq = new XMLHttpRequest(); var pth = Xrm.Page.context.getClientUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF"; retrieveEntityReq.open("GET", pth, false); retrieveEntityReq.setRequestHeader("Accept", "*/*"); retrieveEntityReq.send(); bdy = new VBArray(retrieveEntityReq.responseBody).toArray(); // minimum IE9 required createNotesAttachment(encode64(bdy)); } function encodePdf(params) { var xhr = new XMLHttpRequest(); var pth = Xrm.Page.context.getClientUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF"; xhr.open('GET', pth, true); xhr.setRequestHeader("Accept", "application/json"); xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8"); xhr.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); xhr.responseType = 'arraybuffer'; xhr.onload = function (e) { //xhr.onreadystatechange = function() { if (this.status == 200) { var uInt8Array = new Uint8Array(this.response); base64 = encode64(uInt8Array); CreateEmail(base64); createNotesAttachment(base64); } }; xhr.send(); } function msieversion() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))); else // If another browser, return 0 return 0; } function createNotesAttachment(base64data) { var propertyName; var propertyAddress; var propertyCity; var estimateNumber; // if (Xrm.Page.getAttribute("name") !== null && Xrm.Page.getAttribute("name") !== undefined) // { // estimateNumber = Xrm.Page.getAttribute("name").getValue(); // //alert(estimateNumber); // } // if (Xrm.Page.getAttribute("ccc_propertyid") !== null && Xrm.Page.getAttribute("ccc_propertyid") !== undefined) { // var propertyNameRef = Xrm.Page.getAttribute("ccc_propertyid"); // if (propertyNameRef != null && propertyNameRef != undefined) { // propertyId = propertyNameRef.getValue()[0].id.slice(1, -1); // propertyAddress = propertyNameRef.getValue()[0].name; // var object = getPropertyAddress(propertyId); // propertyName = object[1]; // propertyCity = object[2]; // } // } var post = Object(); post.DocumentBody = base64data; post.Subject = estimateNumber+propertyAddress; post.FileName = "Testing Report " + ".pdf"; post.MimeType = "application/pdf"; post.ObjectId = Object(); post.ObjectId.LogicalName = Xrm.Page.data.entity.getEntityName(); post.ObjectId.Id = Xrm.Page.data.entity.getId(); createEntity(post, "Annotation", ""); } function CreateEmail(base64) { var recordURL; var propertyName; var propertyAddress; var propertyCity; var estimateNumber; var serverURL = Xrm.Page.context.getClientUrl(); var email = {}; var qid = Xrm.Page.data.entity.getId().replace(/[{}]/g, ""); var OwnerLookup = Xrm.Page.getAttribute("ownerid").getValue(); var OwnerGuid = OwnerLookup[0].id; OwnerGuid = OwnerGuid.replace(/[{}]/g, ""); var ContactLookUp = Xrm.Page.getAttribute("im360_selectcontact").getValue(); var ContactId = ContactLookUp[0].id.replace(/[{}]/g, ""); var contactTypeName = ContactLookUp[0].typename; var contactName = ContactLookUp[0].name; //var signature = getSignature(OwnerGuid); // if (Xrm.Page.getAttribute("ccc_recordurl") !== null && Xrm.Page.getAttribute("ccc_recordurl") !== undefined) // { // recordURL = Xrm.Page.getAttribute("ccc_recordurl").getValue(); // //alert(estimateNumber); // } // if (Xrm.Page.getAttribute("name") !== null && Xrm.Page.getAttribute("name") !== undefined) // { // estimateNumber = Xrm.Page.getAttribute("name").getValue(); // //alert(estimateNumber); // } // if (Xrm.Page.getAttribute("ccc_propertyid") !== null && Xrm.Page.getAttribute("ccc_propertyid") !== undefined) // { // var propertyNameRef = Xrm.Page.getAttribute("ccc_propertyid"); // if (propertyNameRef != null && propertyNameRef != undefined) { // propertyId = propertyNameRef.getValue()[0].id.slice(1, -1); // propertyAddress = propertyNameRef.getValue()[0].name; // var object = getPropertyAddress(propertyId); // propertyName = object[1]; // propertyCity = object[2]; // } // } //signature=XMLToString(signature); //alert("OwnerGuid" + OwnerGuid + " signature" + signature); // if (signature == null || signature == undefined) // { // signature = ""; // } var string = "Hello " + contactName + " , Here is the estimate you requested for this location: Estimate # " + "" + " " + "" + " " + "" + ", " + "" + " A PDF copy is attached to this email, as well. If you have any questions about this estimate, please reply back to this email or call me.Thank you for considering us! " + ""; // var string = "Hello " + contactName + " , Here is the estimate you requested for this location: Estimate # " + estimateNumber + " " + propertyName + " " + propertyAddress + ", " + propertyCity + " You can click on the estimate number to view the estimate online to approve it, request changes, etc. A PDF copy is attached to this email, as well. If you have any questions about this estimate, please reply back to this email or call me.Thank you for considering us! " + signature; email["subject"] = "Tesing Subject"; // email["description"] = "Hello "+contactName+" ,"+'\n'+"Here is the estimate you requested for this location:"+'\n'+"Estimate # [ESTIMATE-NUMBER] (linked to the estimate)"+'\n'+" ([PROPERTY-NAME]) [PROPERTY-ADDRESS], [PROPERTY-CITY]"+'\n'+""+'\n'+" You can click on the estimate number to view the estimate online to approve it, request changes, etc."+'\n'+"A PDF copy is attached to this email, as well."+'\n'+"If you have any questions about this estimate, please reply back to this email or call me."+'\n'+""+'\n'+"Thank you for considering us!"+'\n'+""+'\n'+signature; email["description"] = string; email["regardingobjectid_im360_recurringprocess@odata.bind"] = "/im360_recurringprocesses(" + qid + ")"; //activityparty collection var activityparties = []; //from party var from = {}; from["partyid_systemuser@odata.bind"] = "/systemusers(" + OwnerGuid + ")"; from["participationtypemask"] = 1; //to party var to = {}; to["partyid_contact@odata.bind"] = "/contacts(" + ContactId + ")"; to["participationtypemask"] = 2; activityparties.push(to); activityparties.push(from); //set to and from to email email["email_activity_parties"] = activityparties; var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/emails", false); 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]; createEmailAttachment(newEntityId, base64); } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(email)); /////////////////// } function createEmailAttachment(emailUri, base64) { var activityId = emailUri.replace(/[{}]/g, ""); var propertyId; var propertyName; var propertyAddress; var propertyCity; var estimateNumber; // if (Xrm.Page.getAttribute("name") !== null && Xrm.Page.getAttribute("name") !== undefined) // { // estimateNumber = Xrm.Page.getAttribute("name").getValue(); // } // if (Xrm.Page.getAttribute("ccc_propertyid") !== null && Xrm.Page.getAttribute("ccc_propertyid") !== undefined) // { // var propertyNameRef = Xrm.Page.getAttribute("ccc_propertyid"); // if (propertyNameRef != null && propertyNameRef != undefined) { // propertyId = propertyNameRef.getValue()[0].id.slice(1, -1); // propertyAddress = propertyNameRef.getValue()[0].name; // var object = getPropertyAddress(propertyId); // propertyName = object[1]; // propertyCity = object[2]; // } // } var activityType = "email"; //or any other entity type var entity = {}; entity["objectid_activitypointer@odata.bind"] = "/activitypointers(" + activityId + ")"; //entity.body = "ZGZnZA=="; //your file encoded with Base64 entity.body = base64; //your file encoded with Base64 entity.filename = "report" + ".pdf"; entity.subject = "Testing Subject"; entity.objecttypecode = activityType; var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/activitymimeattachments", false); 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]; //alert("attachement created "+newEntityId); } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(entity)); } function getPropertyAddress(pid) { debugger; var ccc_name; var ccc_property1; var ccc_propertycity; var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/ccc_properties(" + pid + ")?$select=ccc_name,ccc_property1,ccc_propertycity", false); 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.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var result = JSON.parse(this.response); ccc_name = result["ccc_name"]; ccc_property1 = result["ccc_property1"]; ccc_propertycity = result["ccc_propertycity"]; } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(); return [ccc_name, ccc_property1, ccc_propertycity]; } function getSignature(OwnerGuid) { debugger; var sig; var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/emailsignatures?$select=presentationxml&$filter=_ownerid_value eq " + OwnerGuid, false); 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.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); for (var i = 0; i < results.value.length; i++) { var presentationxml = results.value[i]["presentationxml"]; oXml = CreateXmlDocument(presentationxml); sig = oXml.lastChild.lastElementChild.textContent; } } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(); return sig; } function CreateXmlDocument(signatureXmlStr) { // Function to create Xml formate of return email template data var parseXml; if (window.DOMParser) { parseXml = function (xmlStr) { return (new window.DOMParser()).parseFromString(xmlStr, "text/xml"); }; } else if (typeof window.ActiveXObject != "undefined" && new window.ActiveXObject("Microsoft.XMLDOM")) { parseXml = function (xmlStr) { var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(xmlStr); return xmlDoc; }; } else { parseXml = function () { return null; } } var xml = parseXml(signatureXmlStr); if (xml) { return xml; } } ////////////////////////////////////////////////////////////////////
↧