Update a existing record instead of creating new record of same entity in MS CRM - dynamics-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.

Related

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

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.

CRM - Transfer list of products from opportunity to order on close opportunity

When closing an opportunity as won, a workflow will run and create an Order based on some of the fields in Opportunity. We are not currently transferring the product list from opportunity to order. We are aware that there is a default relationship between opportunity and product called 'opportunityproduct'.
We need to know if there is a way to transfer the Products from 'opportunityproduct' to 'orderproduct'. Can this be achieved solely through the use of CRM workflow? Or would we need to create a custom Plugin?

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.

Magento: how do I determine if a customer is new?

I want to be able to send different order confirmation emails to new customers than to established customers.
I am already able to put a block in the email template to insert my own 'if' constructs based on order details.
I can get the customer data from the order id, e.g. the customer id, but how can I determine if they are a new customer?
Even if it is getting the customer creation date and checking if it is less than five minutes, I need a technique to determine if they are new from within my template code based on the order information.
Either way your going to just have to do calculations on created_at field in the customer_entity table. If not your going to have to find some specific window to consider customers as "new".
Don't think I'd put said logic in the template file but rather a model and just pass it a block to flag it or not.

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