Call Workflow directly from a button using Ribbon Workbench
Introduction: In this blog we will demonstrate how to call a workflow directly from a button without any custom JavaScript code. Implementation: Step 1: Create the required workflow. In this example i have created a simple workflow on the opportunity and remember to select the “As an on-demand process” option. Step 2: After the workflow is created store the GUID of the workflow. To get the GUID select the workflow and copy down the ID from the URL as shown in the below image. Step 3: Now create the custom button on Opportunity entity using Ribbon Workbench. Step 4: Create a new Command and click on “Add Action>JavaScript Action” as shown in the image. Step 5: In the library option write the following “/_static/_forms/form.js” and in the Function Name field “Mscrm.FormAction.launchOnDemandWorkflowForm“. Then as shown in the above image add two Parameters as follows: Crm Parameter = PrimaryEntityTypeCode String Parameter = “GUID of the Workflow”. Step 6: For the final step add the command to the newly created button by simply selecting it from the drop down in the properties section. Step 7: Now when we click on the button that we created we get the following message. On clicking OK the workflow will run. This is a helpful as it can be done quickly without using any custom code.
Share Story :
Business Process flows process stage name blank in D365 v9 Customer Engagement
Introduction: In this blog, we will demonstrate a way to display the current active stage of a business process flow in views in D365 v9 as the out of box process stage name field does not show any value in the views. Implementation: Step 1: We have created a basic Business Process flow on contacts which has two stages “Basic Information” and “Contact Details”. Step 2: If we want to create a view with the active stage of the business process flow displayed in the column, we first create a new view and in the Record Type we Select Process Stage(Process Stage) and in the columns we select “Process Stage Name” Step 3: Now when we check the view in Contacts we see that the Process Stage Name is blank. Step 4: One workaround for this is to design a Workflow on the Business Process flow entity that was created as shown in the below image . Here “Contact Infor” is the business process flow entity. Step 5: The workflow will be a Real time workflow and will be triggered when process is applied and on change of “processid” field. When the workflow triggers it will copy the name of the field in a new Text field and this can be used in views to display the current Stage as seen below.
Share Story :
Calling unbound actions using Xrm.WebApi in D365 v9
Introduction: In this blog we will be demonstrating how to call an unbound action using Xrm.WebApi which provides properties and methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement The available methods are createRecord, deleteRecord, retrieveRecord, retrieveMultipleRecords,execute and executeMultiple.The execute method executes a single action, function or CRUD operation. Implementation: The syntax for execute method is as follows: Xrm.WebApi.online.execute(request).then(successCallback,errorCallback); Note: This method isn’t supported for Unified Interface and it is only for online mode hence we have to use Xrm.WebApi.online object to execute the method, else it will fail. Step 1: First we create an unbound action. Here in our example we have created an action with the name “new_ActionTest” and we have activated it. In the action steps we have written a step to create a new contact with the name “Jessy David”. Here in our action we an Integer parameter. Any steps can be added as required. Step 2: Below shown code is function used to call the unbound action. Here “boundParameter” parameter is an optional String parameter, we have specified it as null as our action is not bound to any entity. “operationName” is an optional String parameter which is the name of the action.“operationType” is an optional Number parameter which indicates the type of operation we are executing is an Action hence we have specified 0. We can specific 1 for Functions and 2 for CRUD operations. When we run this, the action is called and a new contact is created according to the steps mentioned.
Share Story :
Connecting to Dynamics 365 v9 “metadata reference cannot be resolved” issue fix
Introduction: In the blog we will be discussing about the error while connecting to Dynamics 365 version 9 using console app. Implementation: In our example we will show how to connect to Dynamics 365 using a Console app in v 8.2 and when the same code is used to connect to version 9 we get an error. We will also discuss about how to resolve the issue Step 1: The code show below is used to connect to Dynamics 365 version 8.2 using Console App. Step 2: When we run the above code, we get the following output. Step 3: Now we change the credentials and try connecting to Dynamics 365 v 9 with the same code, we get the following error. Step 4: To solve this issue there are two ways, in the first method, set the Target framework to “.NET Framework 4.6.2 or above”. Step 5: After changing the target version build the solution again and run the app.The connection to Dynamics 365 version 9 environment will be successful. Step 6: The second method is by using the below code before making a connection. TLS stands for “Transport Layer Security,” and is a protocol that is an industry standard designed to protect the privacy of information communicated over the Internet.
Share Story :
Design Marketing Emails in Dynamics 365 for Marketing
Introduction: In this blog we will see how to create a marketing email in Dynamics 365 for marketing preview. Dynamics 365 for marketing provides an easy drag and drop tool to design marketing emails with dynamic personalized content. Implementation: Step 1: We navigate to Marketing Emails and Click on New. We can see there are a number of pre defined email templates The templates are also categorized by purpose Step 2: At the top of the page we see three required fields Name, Subject and Form. The Name is the internal name for the designed email, Subject is the message that will be displayed in the emails subject and the From is the Dynamics 365 user who email recipients will see as the sender Step 3: In the toolbox we can see content blocks which can be used to design the email. We can add text, images , buttons etc as shown below. We can also add Surveys and Marketing Pages to the email which creates a button and on click the user is navigated to the Survey form and marketing page respectively. Step 4: The assist-edit button </> can be used to add dynamic content to the email. Step 5: Once the email is designed as per the requirement in the HTML tab we can see the code is auto-generated. In the preview tab we can see how the email would look in different clients like Desktops, Tablets and mobiles Step 6: It is important point to note is that every email message must include both a subscription centre link and your organizations physical address. These are required by the law in many jurisdiction and Dynamics 365 wont let you publish any marketing email that doesn’t have them. Email templates include them already but when we are working with a blank template you must add them yourself. Step 7: Once the email designing is done we can check for error by clicking on the button in the navigation bar. We can also Test send the email.
Share Story :
Create a marketing segment in Dynamics 365 for Marketing
Introduction: In this blog we will be discussing about marketing segments in Dynamics 365 for Marketing Preview.Marketing is basically promoting some products or services which an individual or organization has to offer. While marketing the main aim to decide a target audience. Once the audience is know, the marketing content can be tailored to target that specific group of people. A market segment is the collection of contacts that you target in a marketing campaign. There are three types of segments a follows: Static Dynamic Compound Implementation: Static Segments: Members in the static segments are added explicitly. These members can be added by the marketer based on the personal interaction that he/she had with the customer. Step 1: Here we created a new static segment in the definitions tab we select the members using the check box as shown below. Initially the segment is in the Draft state. A point to be noted is that segment names can’t have blank spaces. Step 2: Then we save and click the Check for Error on the top ribbon which validates the changes done as shown Step 3: After the validation is passed successfully we can click the Go Live button on the top of the ribbon. Dynamic Segments: The members in dynamic segment keep on changing based on the criteria that is setup. Every time a new contact is added to the system and it fulfills the condition specified in the query, it gets added to the dynamic segment. Step 1: In the designer at the bottom of the page we can see the total segment size which is the total number of members who will be added in the segment. In dynamic segments we design rules using the Designer or Flow or Query. Once we design the view using the designer we can see in the Query tab the query is populated. There are three operators that can be used is, is not and contains. Compound Segments: The third and final type of segment is the compound segment.Compound segments make use of static and dynamic segments which are live. As seen in the image below first we have to select the segment from the drop down and only the segments that are live will appear in the drop down list. Once the segment is selected we click on the arrow and then select one of Union/Exclude/Intersect. Finally, we see at the top of each segment how many members are included or excluded. Conclusion: These segments are used in customer journeys when we want to send marketing emails to a particular group of people.
Share Story :
Editable Grid Validation
Introduction: In this blog we will be discussing about the Business Rule validation issue in Editable grids caused when the fields are not present in the views. Scenario: In our demonstration we will take the example of a contact form and design a business rule to lock the email field if the Job Title field is blank. Implementation: Step 1: First we enable editable gird for the contact entity as shown in the image below. Step 2: Then we create a business rule for the contact form to lock the Email field if the Job Title field is blank. The Business Rule is shown below. Step 3: Now in the editable grid we can see that the Email field is locked as the Job Title is blank. The field is unlocked once the job title is entered. Step 4: Now we edit the criteria of the Business Rule and add a new condition to also check if the Description field contains data as shown in the image below. Step 5: When we go to the editable grid we see that even though the Job Title field is blank the Email field is unlocked which should have been locked. Step 6: The reason behind this is that the My Active Contacts view does not contain the field description hence the validation fails. Step 7: To solve this we add the Description column to the view as shown below. Step 8: Now if we check in the editable grid we see that the validation works correctly and the email field is locked. Conclusion: This is important to be noted as, if there is some validation done using business rules, JavaScript and field is not present in the views the validation wont work and there will be incorrect data entries made using the editable grid.
Share Story :
Open new form with fields pre-populated using Xrm.Navigation in D365
Introduction: Xrm.Navigation provides navigation related methods like openAlertDialog, openConfirmDialog, openErrorDialog, openFile etc. In this blog we will be discussing about openForm method which opens an entity form or a quick create form. There might be requirements to open a new form with certain fields pre-populated on certain conditions or to open a specific record. Implementation: Step 1: Syntax:Xrm.Navigation.openForm(entityFormOptions,formParameters).then(successCallback, errorCallback) Here the parameter entityFormOptions is an Object and is a required parameter. Step 2: In the below example taken, we have written a script on the contact form to trigger on Save which will open up the quick create form with values filled in some of the fields. As we can see in the below image we have passed the execution context as the first parameter. Step 3: The code for the same is given below: scripting={ myfunction:function(executionContext){ debugger; var formContext = executionContext.getFormContext(); var entityFormOptions = {}; entityFormOptions[“entityName”] = “contact”; entityFormOptions[“useQuickCreateForm”] = true; var formParameters = {}; formParameters[“firstname”] = formContext.getAttribute(“firstname”).getValue(); formParameters[“lastname”] = formContext.getAttribute(“lastname”).getValue(); formParameters[“fullname”] = formContext.getAttribute(“fullname”).getValue(); formParameters[“jobtitle”] = “Developer”; Xrm.Navigation.openForm(entityFormOptions, formParameters).then( function (success) { //Any Specific action to be performed console.log(success); }, function (error) { //Any specific action to be performed console.log(error); }); } }; Step 4 : After updating the value and saving the form a quick create form opens up with some of the fields filed out. We get the value of the fields using the formContext.getAttribute(“fieldname”).getValue(); The successCallback and errorCallback are optional. In the Unified Interface the successCallback and the errorCallback function will be executed only if the we are opening the quick create form. Step 5: As seen in the image below we make some changes to the contact form and save the changes. After saving a new contact quick create form opens up with the first name, last name and job title fields filled. Here in our case we have specified entityFormOptions[“useQuickCreateForm”] = true; If this property is not set a normal form open’s up with the values filled in the fields in the same window. If we want to open the new record in a new window we should specify entityFormOptions[“openInNewWindow”]= true which is a Boolean value and it is an optional field. Step 6: If we want to open a specific record we just specific the following entityFormOptions[“entityName”]=”account” entityFormOptions[“entityId”]=”Specify Guid Here” Hope this helped!
Share Story :
Error while importing solutions using Package Deployer
Introduction: Package deployer is used to simplify the deployment process. It has the ability to automate the import of one or more solution.In this blog we will discuss about the error “Verify the state of the solution in CRM” which is shown while importing solution using package deployer. Implementation: Step 1: In the ImportConfig.xml file we give the name of the solutionpackagefilename, that is the name of our solution. Step 2: Then we build the project and copy the folder containing the solution and the Package.dll file created. Step 3: Then we run the Package Deployer application and connect to the organization the below screen shows the solution is successfully unpacked. But after clicking Next when the solution is imported the error shown is as follows. Step 4: In the Log file we can see that the import was not successful due to the missing dependencies. Once the missing dependencies are added the solution is successfully imported using the package deployer . The missing components can be verified if the solution is imported manually.
Share Story :
Create and Associate records using Xrm.WebApi
Introduction: In this blog we will demonstrate how to create and associate records using Xrm.WebApi which provides methods to use Web Api to create and manage records. Implementation: Step 1: The syntax to create a new entity record is as follows: Xrm.WebApi.createRecord(entityLogicalName,data).then(sucessCallback,errorCallback); Here entityLogicalName(string) and data(object) parameters are required. The “data” parameter is a JSON object defining the attributes and values for the new record. Step 2: In this example we will create a sample account record along with a primary contact for that account, associate an opportunity to the account and create task and notes for the opportunity all in a single operation. This type of process is called as a deep insert. The code for the same is as shown below: var scripting = { recordCreation: function () { var data = { “name”: “CRAYONS LTD.”, “description”: “This Account is Created using a Web API”, “creditonhold”: false, “telephone1”: “9954565154”, “address1_city”: “Mumbai”, “primarycontactid”: { “firstname”: “Clinton”, “lastname”: “Dmello” }, “opportunity_customer_accounts”: [ { “name”: “Opportunity Associated to CRAYONS LTD.”, “Opportunity_Tasks”: [ { “subject”: “Task Created” } ], “Opportunity_Annotation”: [ { “subject”: “Note Created”, } ] } ] } Xrm.WebApi.createRecord(“account”, data).then( function success(result) { console.log(“Account Created with ID” + result.id); //perform operations on record creation }, function (error) { console.log(error.message); } ); } }; Step 3: In order to associate to an existing record @odata.bind annotation can be used. For Example: “primarycontactid@odata.bind”:”/contacts(GUID of the contact)”. Screenshots 1. A New Account is created with the name “CRAYONS LTD” and in the primary contact file the primary contact is set with the name Clinton Dmello as set in the code. 2. Also an opportunity is associated to the account as shown below in the associated view. 3. In the opportunity we can see the newly created task in the activities and a note as shown below. Hope this helped!