Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Super Contributor
Posts: 22
Registered: ‎09-14-2011
Accepted Solution

Default Picklist - Web version 7.5.3

I have managed to set the default picklist value via the Admistrator --> Picklist option, and the default is highlighted if you select the picklist control.

 

However my user do not want to have to click on the picklist control.  If a default is set they would like to see it visible in the field, and only click the control if a change is required.

 

I need it for the Insert Opportunity Screen.

 

I have found several pieces of code (one from this forum) that should return the default value, but I can't seem to get it to work.

 

I'm not sure if I'm putting the code in the right Event.

 

Does anyone have any clear instruction on how to achieve this.

 

Thank you

 

Sarah

 

Bronze Super Contributor
Posts: 129
Registered: ‎06-09-2009

Re: Default Picklist - Web version 7.5.3

I believe this is available on 7.5.3, but don't have such an environment available right now:

Sage.SalesLogix.PickLists.GetDefaultItem('ThePicklistID')
It returns an Object of Type PickList, from which you can get the Text Property.
Raul A. Chavez
http://raul.chavez.com
http://www.crmbi.com
Copper Super Contributor
Posts: 22
Registered: ‎09-14-2011

Re: Default Picklist - Web version 7.5.3

Thank you Raul

 

I have been using this section of code with no luck. 

 

I think it might be to do with where I'm placing the code.

 

I've been placing it in the Primary Event for the Opportunity.  Hoping that it would be pulled through to the Insert Opportunity Screen.

 

Any other suggestions, would be welcome.

 

Thanks


Sarah

Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Default Picklist - Web version 7.5.3

First, you need to make a reference to Sage.SalesLogix.PickLists.dll in your business rule:

  1. Click 'AssemblyReferences' from the property window once you're in the code editor for the business rule.  
  2. Click 'Add'
  3. Type in 'Sage.SalesLogix.PickLists.dll' in the AssembleName field
  4. Leave the HintPath blank

 

Now, you can use the following code to set a field to whatever the default picklist item is (we put this code in the OnCreate Event):

 

        account.Type = GetDefaultPicklistItemValue("Account Type");   

 

        ...

 

        public static string GetDefaultPicklistItemValue( string pkName)
        {            
            string sItem = string.Empty;
            try
            {
                Sage.SalesLogix.PickLists.PickList pl = Sage.SalesLogix.PickLists.PickList.GetDefaultItemByName(pkName);
                if (pl != null)
                    sItem = pl.Text;    
            }
            catch (Exception e) {}
            return(sItem);            
        }                        

 

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.