When you are in the context of an Opportunity, then you are also in the context of a Company and Person. You can see this clearly in the screen shot below.
It is easy to test for general context in CreateScripts, Validate scripts and Tablelevel scripts because you can use:
Valid = false;
ErrorStr = "We are in company context";
But how do you tell whether you are looking at the OpportunityList of a Person or the OpportunityList of a company. This could be a very important question if you must have different workflow for when selling to an person or an organisation.
To tell what you primary context is you must check the Key0 value in the QueryString of the URL.
Note: Key0 is also called the Dominant Key.
In a workflow primary rule you can access this with the Values() collection:
In the image below you can see that I have set the check that mean that if I am in the primary context of the company then this rule will not display.
//then we are in company prime context;
//then we are in person prime context;