Change Business Process Flow Based on Form Type Using Java Script.
There are situations where you might need different business process flows based on the form type you choose let us take an example. Consider you want a Business Process flow on the lead entity Such that Lead form will show –BPF with stage Discover, Demo, Propose Sales Lead form will show – BPF with stage Discover, Requirement Gathering, Qualify The case be achieved by doing the following. Lets begin with the implementation. Solution – Step 1: Make a Solution for your customizations and add the lead entity in your solution. Step 2: Make 2 main forms for the lead entity namely “Lead form” and “Sales Lead form” Step 3: Go to process – > Add a new process -> names It Lead creation. Step 4: In the same solution under lead entity add a field of type single line of text namely “Form Type”. Step 5: Add this new field on the lead form and the sales lead form. Note : This field will carry the form type of the form hence will be kept hidden and locked on both the forms. Step 6 : Next step is to get the form type in our form type field to achieve this we will use a web resource that is a java script code Step 7 : By doing so we successfully bring the form type written in our single line of text field. Step 8 : Next step is to create a business process flow in the solution go to process and make a new business process flow. Step 9 : The above snapshot shows the business process flow to achieve the functionality here the create stage we take the form type as a parameter this is then passed to the condition to check the form type Step 10 : So, if the form type is Lead form it will be true and take business process flow for lead form. Step 11 : Else it will be false and will take the business process flow for the sales lead form. Note: – Make sure to add the business process flow as an entity to the solution and select the form and the business process flow in the site map of the app designer. Java Script code : (Onload of the Form) ChangeBPFByType = (executionContext) => { debugger; try { let formContext = executionContext.getFormContext(); const selectedFormName = formContext.ui.formSelector.getCurrentItem().getLabel(); const getFormIdFromTxtBox = formContext.getAttribute(“cfs_formtype”).getValue(); //formContext.getControl(“header_process_cf_leadform”).setVisible(false); if (formContext.data.entity.getId() == “”) { formContext.getAttribute(“cfs_formtype”).setValue(selectedFormName); } else { var getAllForms = formContext.ui.formSelector.items.get(); let navigateFormGuid = “”; for (var i = 0; i < getAllForms.length; i++) { if (getFormIdFromTxtBox == getAllForms[i]._label) { navigateFormGuid = getAllForms[i]._id.guid; break; } } if (getFormIdFromTxtBox != selectedFormName) { formContext.ui.formSelector.items.get(navigateFormGuid).navigate(); } } } catch (e) { alert(“Something went wrong please try again later”); } } Hope that helps.!
Share Story :
Send an Email to all users in a D365 Team using power automate
D365 gives us a functionality to assign a record to a group of users which can be archived by using a D365 Team these users then are know as members of that respective team, due to functionality restrictions we cannot send an email to a D365 team, however there are a few workarounds by which we can achieve this functionality. Lets consider a very case. Suppose we have a D365 team called as “Accounts Associates” we have added a set of users in this team. Now if an invoice milestone is in the ready state i.e. “Ready For Invoicing” we need to send a reminder email to this “Accounts Associates” team to take an action regarding the ready invoicing. Solution :- The following case can be achieved by using an Out of the box functionality i.e. By using a distribution list Note :- (we must have an Microsoft Exchange License). Lets Begin with the implementation. Step – 1 Creating a Distribution List Login to your admin center (Link –https://admin.microsoft.com/) In the Admin center Section of the Left navigation bar select “Exchange”. Under the “recipients” select “groups”. In the “+ New Microsoft 365 Group” pull down the dropdown and add the distribution list. Add the Display name and the “Alias” and save the Distribution list. Add same users which are present in the teams to this Distribution list. Step – 2 Creating a Queue in D365 Go to “Settings” -> “Service Management” ->” Queues” and click on “+NEW” -> give it a name -> “Save” A mailbox would be created with the same name that of the queue. Open the mailbox. The Email address field will be blank, add the Distribution List’s email address created in Step 1. Step -3 Create a New Team or select an Existing Team. In the Default Queue lookup, select the Queue created in Step 2. Step – 4 Create a Flow which triggers on update of a project contract line milestone i.e. When status is ready for invoicing Flow triggers when Project Contract Line is Updated, Condition Invoice Milestone is Ready for invoicing for which click on the “…” select settings and add the following condition in the trigger section. Get the Teams ID in this case I have hardcoded the ID as no record was associated with it to retrieve it Get the Teams Details. Get the Default Queue to which the email will be triggered . Send an Email to the Incoming Email of that Queue which is Email ID set on the Distribution list. Note : (We will have to Manually add or remove the users from both the Distribution list and the Teams. i.e. both the team and the distribution list must be sync, if a member is added or removed from the team the same should be done in the distribution list ) Output . Hope this helps.!
Share Story :
Send an email to users in a D365 Team Individually using power automate (without using a distribution list)
D365 gives us a functionality to assign a record to a group of users which can be archived by using a D365 Team these users then are know as members of that respective team, due to functionality restrictions we cannot send an email to a D365 team, however there are a few workarounds by which we can achieve this functionality. Lets consider a very case.Suppose we have a D365 team called as “Accounts Associates” we have added a set of users in this team. Now if an invoice milestone is in the ready state i.e. “Ready For Invoicing” we need to send a reminder email to this “Accounts Associates” team to take an action regarding the ready invoicing Solution :- The following case can be achieved by Looping through all the users in of a D365 Team.Lets Begin with the Implementation. Step 1 – Create a D365 Team.Go to Security – > Teams -> Create a new team. Step 2 – Create a Flow to send email.1. Flow triggers when Project Contract Line is Updated, Condition Invoice Milestone is Ready for invoicing for which click on the “…” select settings and add the following condition in the trigger section. 2.Get the Teams ID in this case I have hardcoded the ID as no record was associated with it to retrieve it3.Get the Teams Details.4.Get the User Details by using the following fetch XML Query. 5. Query :<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”true”> <entity name=”systemuser”> <attribute name=”fullname” /> <attribute name=”businessunitid” /> <attribute name=”title” /> <attribute name=”address1_telephone1″ /> <attribute name=”positionid” /> <attribute name=”systemuserid” /> <attribute name=”internalemailaddress” /> <order attribute=”fullname” descending=”false” /> <filter type=”and”> <condition attribute=”internalemailaddress” operator=”not-null” /> </filter> <link-entity name=”teammembership” from=”systemuserid” to=”systemuserid” visible=”false” intersect=”true”> <link-entity name=”team” from=”teamid” to=”teamid” alias=”ag”> <filter type=”and”> <condition attribute=”teamid” operator=”eq” uitype=”team” value=”{Your Team ID}” /> </filter> </link-entity> </link-entity> </entity> </fetch> For all the users Send an Email individually to the user OutputUser 1. Which is CRM Admin in my case in the team. User 2 Vidit Gholam system Administrator Hope that helps. !
Share Story :
How to bring in Project Task field from Resource Requirements to Time Entries if imported via, Bookings.
Import Bookings is one of the important features provided by PSA for users to do Time Entries quickly and efficiently. An issue faced while using this functionality is the Project Tasks are not imported with the Bookings Records (As Shown in the Image Below). A solution to this issue is two automated flows: To Bring the Project Tasks from Resource Requirements Entity to Bookable Resource Booking. Hence to bring the obtained Project Tasks from Bookable Resource Booking to Time Entries. Let’s Begin with the Implementation of the solution! (Flow To get Project Tasks from Resource Requirements to Bookable Resource Bookings) Step: 1 Bringing Project Tasks from Resource Requirement’s to Bookable Resource Booking. Step: 2 Update the Bookable Recourse Booking Record with the obtained project task. Now we have successfully obtained the Project task in the Bookable Recourse Bookings Entity from the Resource Requirements, Our Next step is to Take this Project task on the Time Entries. (Flow to get Project Task from Bookable Resource Bookings to Time Entries) Step: 1 Bringing Project Task from Bookable Resource bookings to Time Entries. (Tip : It is better to check if the Project Task Field is empty or not hence we can also put a condition to do so, if the Project Task Field is empty proceed with updating the Project Task field else Terminate.) Step: 2 Get the Project Task from the Bookable Recourse Bookings. Step: 3 Update the Time Entries with the obtained Project task. Step: 4 Import Bookings and there you go you will now be able to see the Project Tasks. Hope this Helps!