• Kelny
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies

Hello,

 

I am developing on non profit salesforce instance and have a problem with setting up field level security. There is an field "DoNotCall" in general fields, however I need to set Visible flag for all profiles. Is it possible to do this with APEX and if so could You please describe me how to do that?

 

Any help would be appreciated.

Thank You Jan

  • April 13, 2011
  • Like
  • 0

Hello,

 

I have difficulty to create a multiselectpicklist by APEX. I received this error: The fullname must be specified in the form CustomObject.CustomField.PicklistValueName.

I have tried to set fullname to several formats like:

"Contact.MyPickList__c.Something";

"Contact.MyPickList__c.Something__c";

etc. But nothing helped.

Can You please suggest me, what am I missing?

 

This is my shorten code:

 

         CustomField cf = new CustomField();
            MetadataService mBinding = new MetadataService();

            mBinding.SessionHeaderValue = new ApexMetadata.SessionHeader();
            mBinding.SessionHeaderValue.sessionId = binding.SessionHeaderValue.sessionId;
            mBinding.Url = binding.Url.Replace(@"/u/", @"/m/");
            cf.fullName = "Contact.MyPickList__c";

            cf.type = FieldType.MultiselectPicklist;

            Picklist p = new Picklist();
            // p.controllingField = field.name;
            List<PicklistValue> values = new List<PicklistValue>();
         
                PicklistValue pVal = new PicklistValue()
                {
                    description = "aaaa",
                    @default = true
                };
                values.Add(pVal);
            
//set picklistValues
            p.picklistValues = values.ToArray();
            cf.picklist = p;
            cf.visibleLines = 3;
            cf.visibleLinesSpecified = true;
            cf.label = "My picklist";
//create
            AsyncResult asyncResult = mBinding.create(new Metadata[] { cf })[0];

 

  • March 30, 2011
  • Like
  • 0