function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlexPHPAlexPHP 

Using stored Ids in Custom Settings automatically adds 3 character suffix?

I have a custom settings field where I store an object field id (15 character Id).

 

When using this custom settings field in an S-Control, it somehow automatically recognizes it is an Id field and adds the 3 character suffix to it!  This makes it the 18 character id.

 

Why is this and how can I fix that?  I do not want the 3 character suffix added automatically. 

Message Edited by AlexPHP on 03-15-2010 11:05 AM
werewolfwerewolf
Are you sure it's not querying it from the API and getting the suffix that way?  In any case, what difference does it make?  The 15 and 18 char IDs are equivalent and can be used interchangeably.
AlexPHPAlexPHP

Thanks for the reply.  Yes, I am simply using the formula field type syntax to access the Custom Settings as noted in the docs.

{!$Setup.CustomSettingName__c.CustomFieldName__c}

I have the custom settings setup as a Hierarchy, and simply a text field containing my 15 character SalesForce Id.  When referencing it it as such, the value is "magically recognized" as an ID and rendered as the 18 character Id.

 

This makes a difference because I am using the custom settings to store the custom object field Ids to use in such things as the query string of a page.  I am using it in such a way so I can pre-populate fields in my layouts for new/edit.  The field (textbox) name is named using the field's ID (15 characters)... setting the ID in the query string as the 18 character Id, therefore does not perform the pre-population of the field with the value in the query string.

 

As a work around, I end up having to modify the "rendered" custom settings value before using it in formula fields using a simple LEFT function to trim the value to 15 characters.

 

{!LEFT($Setup.CustomSettingName__c.CustomFieldName__c, 15)}

This expansion of the ID to 18 characters occurs in S-Controls as well as formula fields, and I assume (though have not tried myself) that it also occurs in VisualForce pages.

 

Thank you for your input.