Sum Quantity from Opportunity Product Entity to a specific Field on an opportunity within the opportunity table - dynamics-crm

I have a list of opportunity product lines associated to opportunities that I want to pass to a field within the opportunity table so users can see this within the opportunity table view. The products in the opportunity lines are Number of learners. For projecting onboarding numbers for the month I want to add one field to my opportunity entity.
Total number of learners
This field would be populated by the total quantity of all "learners" products in the opportunity product lines.
I have tried a roll up field, but I can't seem to get it to sum up the quantity of products to appear within the new field created in the opportunity entity.
What features of Dynamics CRM could help me achieve this? MS workflow?
Rollup
Product Line
Rollup field on Form

rollup field should solve your req.
If that does not solve your problem, Then you can create Power autome/ cloud flow.
If not you can create Plugin
If not Javascript.
But my best bet or choice would be rollup and then cloud flow.

Related

Update a existing record instead of creating new record of same entity in MS CRM

I have work order product entity which have product, status and quantity field in MS CRM online. When user tries to create a new record of work order product entity, quantity of existing work order product record with same product should be increased instead of creating new work order product record (without letting user know). Can anyone explain how to achieve this requirement ? This should work for creating record by form or by data import/export.
You must write a plugin in the creation event (post operation) of the order product. In this plugin you need to check if you have another ordering product with the same product.
If so, you must increase the quantity of your existing product order and delete the new one.
If you want to have a good user experience, you can send an alert to your user to inform them of this logic when creating a new order product with the same product as that of an old one.

Sum Opportunity Line Quantity Dynamics CRM

I have a list of opportunity product lines associated to the opportunity. The products in the opportunity lines are labor based, engineering services. For projecting resource requirements I want to add two fields to my opportunity entity.
Total Labor Effort
This field would be populated by the total quantity of all "labor based" products in the opportunity product lines.
Weighted Labor Effort
Same as Total Labor Effort, except the value will be multiplied by the probability of closing the deal. This is a separate custom field in the opportunity.
I have tried a roll up field, but I can't seem to get it to sum up the quantity of the products in the product lines. It will only look at the product lines themselves. Calculated field seem to be more limited even.
What features of Dynamics CRM could help me achieve this?
If I could add my 2 cents,
There is indeed rollup field limitation here.
Now I could sense 2 ways to achive this.
Dynamics-365-Workflow-Tools
Reason been, this is well documented and up to date with latest CRM Version and especially fucntion query Values
If you don't want to add overhead of adding any 3rd party solution may it be free of cost, I would move my logic to Plugins i.e custom c# code to perform operations (server side)
I personally would go for custom code, you have more control of what you want to achieve there.
I recommend using Kaskela Workflow Elements, a free workflow extension that can query the opportunity products and return the number of line items: https://kaskelasolutions.com/current-query-get-results/
After you import Workflow Elements, you will need two workflows:
1. one that is started whenever a product line item is created /modified/deleted and it will update a "trigger" field on the opportunity, such as a "date detail changed"
2. one on the Opportunity that will count the detail lines.
In the 2nd workflow, use the "Query - Get Results" feature
You will need to create a FetchXML query to get the Opportunity Line items - you can use Advanced Find to create the query. This looks a bit strange because you create the query using the child records and link back to the parent opportunity, but this is how Kaskela filters the results to just the Opportunity Lines that are related to the opportunity.
The next step in your workflow is to insert the results into the opportunity record:
Ultimately I solved this using MS Flow to retrieve all the Opportunity Line from an "updated" Opportunity and summing them up before finally writing to the Opportunity field. For weighted value I made a simple calculated field based on the close probability and total labor effort.
MS FLow Screen Shot

How to get tax amount(both group and percent) individual product in account_invoice(Sale)?

While creating report I need to take tax amount for individual product from account.invoice (sale). Have tried SQL query but it is not possible so how can I do that?
A SQL query is possible but it could get hard if you try to make the calculations in pure SQL. account.invoice.line has a Many2many field invoice_line_tax_ids that you can use in your SQL query as a mapping table (database table account_invoice_line_tax that has fields invoice_line_id and tax_id).
If you want to make this job easier for yourself, create a new computed field (remember store=True) for account.invoice.line that calculates the taxes by line using the same methods Odoo uses. See account.invoice.line._compute_price for example.
If you need the taxes by product instead of by invoice line, just group the invoice lines by product in your report.

Product slug not working in CRM 2013 Email templates

I have a business requirement that execs are really wanting to see. In our lead and email templates we have a few of our products listed. The products themselves are pretty stable but the prices are of course subject to change.
I'm OK with hard coding the product name into email but I was hoping the price could be a slug that get's resolved.
We only have one price list so nothing to worry about there.
I see no way to get access to the product and or price list entities through the data field values dialog.
So my thought was to create the 2-4 fields in the lead and opportunity entities. Then create a background workflow that takes the price from the price list and sets those fields.
Then when an email is generated I can access those hidden fields as they will be available through the lead or opportunity entity.
Any thoughts, concerns, better approaches?
Unfortunately CRM's email template system is not capable of what you describe out of the box. As you have discovered it will only permit you to insert placeholders from, or assocated with, the primary entity. It won't let you insert fields from other entities. What you suggest as a workaround is possible but it's not an ideal solution as you'll have these 2-4 redundant fields on each record type that contain duplicated data from the price list.
If you have any experience with creating custom workflow activities using the SDK then the best solution here is to create a custom activity that accepts either an draft Email or Email template as a input parameter, instantiates the email if required, loads the price list data, and performs your own custom placeholder replacements.
I've done this on a few projects in order to pass multiple entity records into the template, or to insert complex tables into emails by loading data from relationships. See the screenshots below for an example of how I've configured the email template and dialog process to pass both an 'Account' and 'User' record into the email template.

Creating a Relationship Between Order Product (salesorderdetail) and Service Activity (serviceappointment)

We are using Microsoft CRM 4.0 to run a consulting business. Its working pretty well but we want to simplify the way we are doing some things. What we want to do is create an Order (salesorder) with multiple Order Products (salesorderdetal). So good so far.
Next I want to be able associate each Order Product (salesorderdetail) with a Service Activity (serviceappointment), this representing that this billable line item in the order is actually going to be fulfilled as a consuting engagement.
The problem is, I can't seem to be able to create an association between the Order Product (salesorderdetail) and Service Activiy (serviceappointment). It simply doesn't appear in the drop downlist.
Can anyone think of a reason for this? I've seen some posts about relating field mapping between Quote Product, Order Product, Opportunity Product and Invoice Product, but that isn't quite what I am after.
Any suggestions gratefully received - even if it is an explaination of why its not possible.
I created a simple 1:N mapping from Case to Invoice. The Case records its ID and Title in custom fields in the Invoice. Unfortunately this does not allow for product creation as children of the Invoice, so that should be created as a custom code workflow.

Resources