Monday, March 15, 2010

Picklist Pre Default Field

I just got an opportunity to use this undocumented user property for the first time and thought it useful to explain how it is used. Let's say you have an object like a Service Request where you have a pick applet that allows the creation of a record in another object, like a contact. In addition you have constrained the SR Contact to only show contacts for the already selected SR Account. When you create a new contact in the Pick Applet, you presumeably want the Account to be predefaulted to the SR Account since you have it constrained to be so, but Siebel does not do this automatically.

The trick is getting the Contact field to predefault to a field on the Service Request, in this case, Account. To do this, create new User Properties on the Contact BC:

Name: Picklist Pre Default Field 1
Value: "Account Id", "'Service Request.Account Id', 'Action.Account Id'"

Name: Picklist Pre Default Field 2
Value: "Account", "'Service Request.Account', 'Action.Account'"

Name: Picklist Pre Default Field 3
Value: "Account Location", "'Service Request.Account Location', 'Action.Account Location'"

The value expression is the field on the target BC to set (Contact in this case), followed by a comma separated list of Source BC.Field pairs enclosed in quotes. Notice the quotes. Entire expression enclosed in double quotes, and each BC.Field pair enclosed in single quotes. I made sure that the fields on the Source BC had the link spec checked just in case.

I am using a 1:M Account:Contact relationship in this example so I am not sure whether this works when Account:Contact is M:M. Additional testing would be necessary. Also this is an undocumented user property as of 8.0 so not sure whether it will work on all BC classes but I tried it on Contact and it definately worked there.

2 comments:

  1. Hi,
    This User Property is used to set the value in MVG Applets right(in the parent BC)?? say for an instance If we want to use the predefault values in an Static Pick List then this case will not work ya..?

    ReplyDelete
  2. I am not aware of this user property's application in an MVG. I believe it is explicitly designed for use in a Pick applet, not an MVG. So I am not really sure what behavior you would see if you used it in an MVG, but I believe you would not see anything.
    (Unless you were launching a pick applet from an MVG in which case that is probably valid)

    I would need to understand better what your intent is regarding predefaulting a value in a static picklist. This property drives functionality after creating a new record in the picklist BC. If you are using a static picklist, the picklist BC is List Of Values which typically does not allow insert, so it would not really make sense to use it.

    If the question is that you want to predefault a field in a dynamic picklist (such as a picklist of contacts opened from an activity) where the field has a static picklist, then yes, I think you could do that. You could just create a calculated field on the activity whose value is a constant and use that field in the user property expression.

    ReplyDelete