Fetching Ownership of a record on which user is working

This article has been submitted by Prashant Varshney reader of Siebel Unleashed.


Requirement:

Check the ownership of a record on which user is working and based on ownership, BC record should be either editable or read-only. Ownership means the record on which user is working is either assigned to user or user is the manager of that record. This kind of requirement usually exist in a scenario where it is required to give both My and All views to one responsibility and it is required that the records on which user has access can only be editable to the user, rest records should remain read only.

Solution:

There are two parts of this solution which I have mentioned in part A (editable to user and managers) and B (read-only for others):
Fetching IS Manager value in a calculated field:

  1. Create a join on S_CONTACT table having join spec as
    Destination Column=PAR_ROW_ID
    Source Field=Primary Owner Id of the record (OWNER_PER_ID)
  2. From this join (S_CONTACT) fetch the PR_HELD_POSTN_ID and name this field as say Primary Owner’s – Primary Position Id
  3. Create a link between Parent BC and Party Reporting Relationship on which it is required to check if the record on which user is working is the manager (User position exist in the Parent position of that record) having below spec:
    Source Field=Primary Owner Primary Position Id
    Destination Field=Party Id
  4. From this link create a MVL on the Parent BC having following spec:
    Name=Manager Positions
    Destination Bus Comp=Party Reporting Relationship
    Destination Link=Link created in step 3
    Source Field= Primary Owner Primary Position Id
  5. From this MVL create a MVF using below specs:
    Name=Manager Position Id
    MVL=Manager Positions
    Field=Parent Party Id
  6. Create a calculated field having below specs:
    Name=IsManager
    Calculated Value=IIf(EXISTS([Manager Position Id] = PositionId()), ‘Y’, ‘N’)
  7. Now this calculated field will give value as Y if the Parent Position of the record on which user is working equals to the logged on user position.Fetching IS Owner value in calculated field:
  8. Create a calculated field having below specs:
    1. Name=IsOwner
      Calculated Value=IIf([Primary Owner Primary Position Id]=PositionId(),’Y’,’N’)
    2. Finally created another calculated field as:
      Name=Ownership
      Calculated Value=IIf([IsOwner]=”Y” OR [ISManager]=”Y”,”Y”,”N”)

This ownership field can be used in either BC user property, Applet User Property, eScripting, state models etc and the requirement can be achieved.

Note: I haven’t been able to implement and test the validity of solution (due to unavailability of time) but it seemed logically correct hence posting it. Please feel free to point out if something is missing or out of place.

I will be back soon with bigger and better Open UI post please stay tuned. Thanks for your continued support.

Leave a Reply

Contribute