What is the best value to use for an Id of a specific SObjectType that matches no records?What are Salesforce ID's composed of?Converting the Salesforce Pod Id to ServerUrl/NameQuerying Related objects using Partner Apiwant to auto click the link when a field update happens picklist value is “sent customer”Duplicate ID error - Don't understand other explanationsWhat are Best Practices for Upserting Objects with Foreign Key Members (i.e. References to Other Objects)What is the value of the first and final record id for an object?Id value is not valid for the Knowledge__kav standard controllerLightning how to pass attribute value from one component to other when a link is clicked from the table row of records

How to compare integers in Tex?

Does AES-ECB with random padding added to each block satisfy IND-CPA?

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

What would happen if I build a half bath without permits?

Can you cure a Gorgon's Petrifying Breath before it finishes turning a target to stone?

What does it mean by "my days-of-the-week underwear only go to Thursday" in this context?

Is there any site with telescopes data?

Avoiding dust scattering when you drill

Would allowing versatile weapons wielded in two hands to benefit from Dueling be unbalanced?

Should I be on the paper from another PhD student that I constantly went on his meetings?

How to export all graphics from a notebook?

How do we know neutrons have no charge?

Realistically, how much do you need to start investing?

Smallest PRIME containing the first 11 primes as sub-strings

Impersonating user with Core Service App and Angular client

How deep is the liquid in a half-full hemisphere?

What are one's options when facing religious discrimination at the airport?

How to visualize an ordinal variable predicting a continuous outcome?

Worlds with different mathematics and logic

How to work around players whose backstory goes against the story?

How is the Apple Watch ECG disabled in certain countries?

How big would the ice ball have to be to deliver all the water at once?

Top off gas with old oil, is that bad?



What is the best value to use for an Id of a specific SObjectType that matches no records?


What are Salesforce ID's composed of?Converting the Salesforce Pod Id to ServerUrl/NameQuerying Related objects using Partner Apiwant to auto click the link when a field update happens picklist value is “sent customer”Duplicate ID error - Don't understand other explanationsWhat are Best Practices for Upserting Objects with Foreign Key Members (i.e. References to Other Objects)What is the value of the first and final record id for an object?Id value is not valid for the Knowledge__kav standard controllerLightning how to pass attribute value from one component to other when a link is clicked from the table row of records






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















With reference to the very informative What are Salesforce ID's composed of?, I am wondering what the best value to use for an Id of a specific SObjectType that matches nothing is.



If I understand that link correctly, the Id should be something like:



SObjectType t = ...;
Id id = t.getDescribe().getKeyPrefix() + '000' + 'xxxxxxxxx';


But what is a good value to use in place of 'xxxxxxxxx' e.g.:



'zzzzzzzzz'
'ZZZZZZZZZ'
'ZzZzZzZzZ'
'000000AAA'
'NoMatchId'
'xxxxxxxxx'









share|improve this question
























  • I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

    – Pranay Jaiswal
    8 hours ago












  • Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

    – Keith C
    8 hours ago

















2















With reference to the very informative What are Salesforce ID's composed of?, I am wondering what the best value to use for an Id of a specific SObjectType that matches nothing is.



If I understand that link correctly, the Id should be something like:



SObjectType t = ...;
Id id = t.getDescribe().getKeyPrefix() + '000' + 'xxxxxxxxx';


But what is a good value to use in place of 'xxxxxxxxx' e.g.:



'zzzzzzzzz'
'ZZZZZZZZZ'
'ZzZzZzZzZ'
'000000AAA'
'NoMatchId'
'xxxxxxxxx'









share|improve this question
























  • I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

    – Pranay Jaiswal
    8 hours ago












  • Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

    – Keith C
    8 hours ago













2












2








2


1






With reference to the very informative What are Salesforce ID's composed of?, I am wondering what the best value to use for an Id of a specific SObjectType that matches nothing is.



If I understand that link correctly, the Id should be something like:



SObjectType t = ...;
Id id = t.getDescribe().getKeyPrefix() + '000' + 'xxxxxxxxx';


But what is a good value to use in place of 'xxxxxxxxx' e.g.:



'zzzzzzzzz'
'ZZZZZZZZZ'
'ZzZzZzZzZ'
'000000AAA'
'NoMatchId'
'xxxxxxxxx'









share|improve this question














With reference to the very informative What are Salesforce ID's composed of?, I am wondering what the best value to use for an Id of a specific SObjectType that matches nothing is.



If I understand that link correctly, the Id should be something like:



SObjectType t = ...;
Id id = t.getDescribe().getKeyPrefix() + '000' + 'xxxxxxxxx';


But what is a good value to use in place of 'xxxxxxxxx' e.g.:



'zzzzzzzzz'
'ZZZZZZZZZ'
'ZzZzZzZzZ'
'000000AAA'
'NoMatchId'
'xxxxxxxxx'






salesforce-id






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









Keith CKeith C

102k14 gold badges105 silver badges244 bronze badges




102k14 gold badges105 silver badges244 bronze badges















  • I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

    – Pranay Jaiswal
    8 hours ago












  • Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

    – Keith C
    8 hours ago

















  • I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

    – Pranay Jaiswal
    8 hours ago












  • Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

    – Keith C
    8 hours ago
















I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

– Pranay Jaiswal
8 hours ago






I use fflib_IDGenerator and it uses 00000000 and each time new Id is generated it keeps a track so next time you ask for new Id it doesnt get repeated

– Pranay Jaiswal
8 hours ago














Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

– Keith C
8 hours ago





Hi @PranayJaiswal, Its an Id value that can be thrown into queries and match nothing rather than just a random Id that might match something in the database that I'm looking for. Thanks for the comment though.

– Keith C
8 hours ago










1 Answer
1






active

oldest

votes


















3
















You can use all zeroes (e.g. keyPrefix + '0'.repeat(12)). It will never match an existing or future ID. Depending on your use case, you can also generally just use '0'.repeat(15), which is what Salesforce uses internally to represent a null ID. Obviously, the 0-key-prefix pattern doesn't match a specific sObject, but might be valid for some use cases. Note that this presumes you're using 15-character ID values. If you calculate the parity bits at the end, remember it may not always be AAA, so consider Id.valueOf(keyPrefix+'0'.repeat(12)) instead to get the correct suffix.






share|improve this answer

























  • The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

    – Keith C
    8 hours ago














Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f279265%2fwhat-is-the-best-value-to-use-for-an-id-of-a-specific-sobjecttype-that-matches-n%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3
















You can use all zeroes (e.g. keyPrefix + '0'.repeat(12)). It will never match an existing or future ID. Depending on your use case, you can also generally just use '0'.repeat(15), which is what Salesforce uses internally to represent a null ID. Obviously, the 0-key-prefix pattern doesn't match a specific sObject, but might be valid for some use cases. Note that this presumes you're using 15-character ID values. If you calculate the parity bits at the end, remember it may not always be AAA, so consider Id.valueOf(keyPrefix+'0'.repeat(12)) instead to get the correct suffix.






share|improve this answer

























  • The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

    – Keith C
    8 hours ago
















3
















You can use all zeroes (e.g. keyPrefix + '0'.repeat(12)). It will never match an existing or future ID. Depending on your use case, you can also generally just use '0'.repeat(15), which is what Salesforce uses internally to represent a null ID. Obviously, the 0-key-prefix pattern doesn't match a specific sObject, but might be valid for some use cases. Note that this presumes you're using 15-character ID values. If you calculate the parity bits at the end, remember it may not always be AAA, so consider Id.valueOf(keyPrefix+'0'.repeat(12)) instead to get the correct suffix.






share|improve this answer

























  • The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

    – Keith C
    8 hours ago














3














3










3









You can use all zeroes (e.g. keyPrefix + '0'.repeat(12)). It will never match an existing or future ID. Depending on your use case, you can also generally just use '0'.repeat(15), which is what Salesforce uses internally to represent a null ID. Obviously, the 0-key-prefix pattern doesn't match a specific sObject, but might be valid for some use cases. Note that this presumes you're using 15-character ID values. If you calculate the parity bits at the end, remember it may not always be AAA, so consider Id.valueOf(keyPrefix+'0'.repeat(12)) instead to get the correct suffix.






share|improve this answer













You can use all zeroes (e.g. keyPrefix + '0'.repeat(12)). It will never match an existing or future ID. Depending on your use case, you can also generally just use '0'.repeat(15), which is what Salesforce uses internally to represent a null ID. Obviously, the 0-key-prefix pattern doesn't match a specific sObject, but might be valid for some use cases. Note that this presumes you're using 15-character ID values. If you calculate the parity bits at the end, remember it may not always be AAA, so consider Id.valueOf(keyPrefix+'0'.repeat(12)) instead to get the correct suffix.







share|improve this answer












share|improve this answer



share|improve this answer










answered 8 hours ago









sfdcfoxsfdcfox

287k14 gold badges236 silver badges496 bronze badges




287k14 gold badges236 silver badges496 bronze badges















  • The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

    – Keith C
    8 hours ago


















  • The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

    – Keith C
    8 hours ago

















The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

– Keith C
8 hours ago






The zeroes sound good. I do want to keep the key prefix as down the line code uses the type of the Id. Thanks!

– Keith C
8 hours ago



















draft saved

draft discarded















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f279265%2fwhat-is-the-best-value-to-use-for-an-id-of-a-specific-sobjecttype-that-matches-n%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480