Thursday, June 25, 2015

MSCRM 2015: Calculate Gross Profit Margin with Rollup Field

I added a few custom fields and a small amount of JScript to the quote form to calculate the gross profit margin.
  1. The fields to create:
    • Profit (optional): currency type field that will provide the total profit in dollars.
    • Profit Margin %: a decimal type field.
    • Total Cost: a currency rollup field. Here’s what mine looks like. I have a custom field called Cost on my quote product form that brings in the product cost from the product catalog.
    •  
  2.  Put your custom fields onto your form. I also put the Total Amount field on my form again but put it closer to where I was calculating the GPM so that it was obvious to the user which numbers were being used in the calculation.
  3.  Add Jscript to the OnChange event for the Total Cost and Total Amount fields:
    • function calcGPM() {
        var totalCost = Xrm.Page.getAttribute("new_totalcost").getValue();
        var totalAmount = Xrm.Page.getAttribute("totalamount").getValue();
        var profit = totalAmount - totalCost;
        Xrm.Page.getAttribute("new_profit").setValue(profit);
        var gpm = (1 - (totalCost/totalAmount)) * 100;
        Xrm.Page.getAttribute("new_profitmargin").setValue(gpm);
      }
       
  4. Publish and test your changes!

3 comments:

Embedded training in chennai said...

WIZTECH Automation, Anna Nagar, Chennai, has earned reputation offering the best automation training in Chennai in the field of industrial automation. Flexible timings, hands-on-experience, 100% practical. The candidates are given enhanced job oriented practical training in all major brands of PLCs (AB, Keyence, ABB, GE-FANUC, OMRON, DELTA, SIEMENS, MITSUBISHI, SCHNEIDER, and MESSUNG)

PLC training in chennai
Automation training in chennai
Best plc training in chennai
PLC SCADA training in chennai
Process automation training in chennai
Final year eee projects in chennai
VLSI training in chennai

Coco Ada said...

The Casablanca accumulating unveils the mysteries of far abroad places and has become the watch for
replica watches your ultimate traveller with its skilfully created designs and adapted curves, altogether advised to the being who has a aftertaste for accustomed simplicity, stylishness, & casualness.Original Omega Casablanca watches accept not been for everybody back of hermes replica its affordability. Having said that, www.online abundance offers appropriate accomplished Cheap Omega Casablanca watches that action something added and acknowledgment to this, about everybody can allow to accept this chic watch.
The humans at www.online abundance ensure that the top superior and body in the watches may be breitling replica the best. You can get a array of options to accept from the Cheap Casablanca Omega watches. Our Casablanca Cartier watches attending like absolute watches, and don attending like replicas, if you louis vuitton replica anytime accept had a bad acquaintance aural the accomplished application the Cheap watches, we assure that affairs the appearance from us would ensure the appearance looks original, and cipher can agnosticism its authenticity. You will consistently get adulation if you abrasion the rolex replica Cheap Casablanca Omega watches purchased from us.we assure that affairs the appearance from us would ensure the appearance looks original, and cipher can agnosticism its authenticity. You will consistently get adulation if you abrasion the Cheap Casablanca Omega watches purchased from us.





Hua Cai said...

cheap jordans
hollister
nba jerseys
nike free 5
michael kors online outlet
coach outlet
polo ralph lauren
jordan 11
michael kors outlet
pandora jewelry
louboutin pas cher
burberry sunglasses
cheap michael kors handbags
louis vuitton neverfull
cheap oakley sunglasses
fitflops sale
coach outlet online
hollister shirts
nike uk store
mulberry handbags
ray ban sunglasses
tory burch outlet
asics
cazal outlet
thomas sabo outlet
true religion jeans sale
polo pas cher
true religion canada
coach outlet canada
polo ralph lauren
adidas shoes
michael kors handbags
ralph lauren outlet
tiffany and co
cheap snapbacks
20160716caihuali