Dynamic picklist from CRM 3.0 to 4.0

Dynamic picklist from CRM 3.0 to 4.0

Post by YmVhdG1hc3 » Wed, 15 Apr 2009 18:18:01


i,
another problem that appeared after the upgrade from crm 3.0 to 4.0. We did
a dynamic picklist in CRM 3.0 that fetched users that had secretary role and
added them to an empty piclist. That worked fine in 3.0 and works well in 4.0
also until you try to save the entity. then I get the following error in
Trace log

--------------------------------------------------------------------------------------------------------
Error: A validation error occurred. The value of 'new_sihteeri' on record
of type 'quote' is outside the valid range.

Error Number: 0x8004431A

Error Message: A validation error occurred. The value of 'new_sihteeri' on
record of type 'quote' is outside the valid range.

Error Details: A validation error occurred. The value of 'new_sihteeri' on
record of type 'quote' is outside the valid range.

Source File: Not available

Line Number: Not available

Request URL: http://kuukkeli:5555/TAKK/sfa/quotes/edit.aspx

Stack Trace Info: [CrmPicklistAttributeValidationException: A validation
error occurred. The value of 'new_sihteeri' on record of type 'quote' is
outside the valid range.]
at
Microsoft.Crm.ObjectModel.PicklistAttributeValidator.Validate(DynamicEntity
entity, Property property, AttributeMetadata attributeMetadata,
ExecutionContext platformContext)
at
Microsoft.Crm.ObjectModel.AttributeValidationPlugin.PerformValidation(DynamicEntity entity, EntityMetadata entityMetadata, ExecutionContext platformContext)
at
Microsoft.Crm.ObjectModel.AttributeValidationPlugin.Execute(IPluginExecutionContext context)
at
Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext
context)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext
context)
at
Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String
messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode,
PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken
originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode,
Int32 secondaryObjectTypeCode, CorrelationToken correlationToken,
CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken
correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid
callerId)
at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request,
CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth
userAuth, Guid callerId)
at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
at
Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
at
Microsoft.Crm.Application.Platform.ServiceCommands.CreateCommand.Execute()
at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean
performDuplicateCheck)
at Microsoft.Crm.Application.Platform.Quote.Create(Boolean
performDuplicateCheck)
at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity,
FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)

The code in the form for adding the values to picklist is following
for(var i=0; i < splittedresult.length; i+
 
 
 

Dynamic picklist from CRM 3.0 to 4.0

Post by Demeilliez » Wed, 15 Apr 2009 23:18:28

hat's because you add "data" to the picklist @ runtime I guess?

Well you should add an extra "Hidden" field to hold the data they've chosen
in the picklist! Then when you save, you should make the "Picklist" empty!
When emptying the "picklist" you won't receive an error!

var picklistChildrenCount = myPicklist.Options.length;
for(i = 0; i < picklistChildrenCount; i++)
{
myPicklist.DeleteOption(i);
}

In the onload you do all the smart-thinking and put back the needed
"picklist"-values & select the right one :)

Hope this helps;

Kind regards,
frederic
"beatmasta" < XXXX@XXXXX.COM > schreef in bericht
news: XXXX@XXXXX.COM ...



 
 
 

Dynamic picklist from CRM 3.0 to 4.0

Post by YmVhdG1hc3 » Fri, 17 Apr 2009 15:47:01

hanks for the tip! Worked like a charm!
Actually we have that hidden field in use for saving the piclist value and
selecting the correct row on onload, but that picklist emptying we didn't
have! Nice trick. And it works even the picklist is a required field, so the
CRM seems to check the fields before the OnSave occurs.

Thanks a lot!
Pete

"Demeilliez Frederic" wrote: