Monday, March 21, 2011

Updating Read-Only Dynamics CRM 2011 Fields (Pipeline Phase and Probability) from a Sales Stage Dropdown

We’re setting up Dynamics CRM 2011 at my workplace and I had to figure out how to set up our pipeline. Here’s my solution:

fffcpplt

I created a Sales Stage field that updates the Pipeline Phase and Probability fields on change. I followed Ayaz Ahmad’s solution for hooking up a javascript function to my Opportunity form and then wrote the following function (after some iteration).

function new_SalesStage_OnChange()
{
var new_salesstageAttr = Xrm.Page.getAttribute("new_salesstage");
var stepnameAttr = Xrm.Page.getAttribute("stepname");
var closeprobabilityAttr = Xrm.Page.getAttribute("closeprobability");

closeprobabilityAttr.setSubmitMode("always");
stepnameAttr.setSubmitMode("always");

if (new_salesstageAttr.getSelectedOption() == null)
{
stepnameAttr.setValue("");
closeprobabilityAttr.setValue(null);
}
else
{
var ssVal = new_salesstageAttr.getSelectedOption().text;
var pl = ssVal.lastIndexOf('%');
var probability = parseInt(ssVal.substring(pl-2, pl));

stepnameAttr.setValue(ssVal);
closeprobabilityAttr.setValue(probability);
}
}

The biggest tricks were:



  • Using LOWER CASE names for my field names.  This breaks if I use getAttribute(“new_SalesStage”), which is it’s real name.  Booo, Microsoft!!!
  • Handling the null value.
  • Using the setSubmitMode(“always”) call to make sure the readonly fields were beiing saved.

This solution should have been quicker but I learned a lot on it.

  

Friday, March 04, 2011

This means war! Forcing collaboration

Whether you’re trying to convince Moammar Gadhafi to stand down or trying to work with coworkers, you are at war.  I don’t mean this in a bad/negative way, I mean it in a real(istic) way.  People are competitive and out for their own.  They may be your coworkers and friends but in my experience, it’s still competitive; it’s still a battle and a daily challenge.

To me, the elements of collaboration are as follows: the people, roles, relationships, events, actions, and artifacts/documents/messages have to be defined and shared effectively for a given relationship to be successful and beneficial. 

Sure we can operate under other pretenses: avoidance, control, dictatorship, and subversion but our goal should always be collaboration and partnership.  We may grow tired and give up on certain objectives, but we have to keep going on, keep forming the relationship and agreement.

In work and business I think this is far easier (and more necessary) than in personal relationships.  But you have to define these things. 

I’m dealing with one of our senior executives at work no, trying to form a clear and beneficial relationship between the sales/account management/business development functions and the project management/planning/delivery function.  This distinction/division is relatively new (probably better stated as IMMATURE) within our company, so there is a lot to do.  First we have to figure out each others’ incentives and interests and then we can figure out a working relationship / process / protocol that works and benefits the organization.

These things take time but if you stay after it you (and the other party) will win.

Thursday, March 03, 2011

Identify those who you will let manage and influence you wisely

This should be simple.  You should choose your boss and your bosses.  They should all be allowed to manage you.  Don’t fight it.  Some may be clueless idiots, but others may be extremely talented and really able to help you out.

When it comes to finding the right people for you to work with daily and repeatedly (your best friends within a project or organization), choose wisely.  Know your criteria.  Do you want them to be your friend?  Do you want them to be smarter than you?  Dumber?  Superior?  More junior?  More senior?

Whichever way you go, choose your work-friends and partners wisely.  Getting this wrong will really suck.  You can choose who these followers are and do it wisely.

Wednesday, March 02, 2011

Fluent API Navigation–What’s the member returning?

Getting up and down an object map isn’t easy, especially when you don’t understand the API.  Some APIs allow “chaining” where I can write something like Coffee.MakeCup().CupSize(‘Large’). 

What this example implies is that each child member/method call returns itself or the base.  Determining if something is returning itself or the base is a pretty big distinction / way of thinking.

This can be applied to people: does this guy really believe what he’s saying or is he just a talking head?  People that “return the base” are not representing themselves.  People who return themselves are real and authentic. 

I’m not saying that one is better than the other but there are situations and needs for both.  This is a fundamental design decision.