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;
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
add a comment
|
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
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
add a comment
|
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
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
salesforce-id
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
add a comment
|
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
add a comment
|
1 Answer
1
active
oldest
votes
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.
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
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment
|
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.
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
add a comment
|
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.
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.
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
add a comment
|
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
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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