IM Salesforce
⭐𝑯𝒐𝒘 𝒕𝒐 𝒄𝒉𝒆𝒄𝒌 𝒊𝒇 #𝑺𝒂𝒍𝒆𝒔𝒇𝒐𝒓𝒄𝒆 𝑶𝑹𝑮 𝒊𝒔 𝑺𝒂𝒏𝒅𝒃𝒐𝒙 𝒐𝒓 𝑷𝒓𝒐𝒅𝒖𝒄𝒕𝒊𝒐𝒏 ❓ ⏩ Using Apex class to check if the current ORG is a sandbox or Production. ⏩ Salesforce has a sObject called Organization. ⏩ This sObject has a standard field, IsSandbox Which will be true if it is a sandbox. ⏩ For Production this field will be false. ⏩ Sample Code: 𝐎𝐫𝐠𝐚𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧 𝐚_𝐎𝐑𝐆 = [𝐒𝐞𝐥𝐞𝐜𝐭 𝐈𝐝, 𝐍𝐚𝐦𝐞, 𝐈𝐬𝐒𝐚𝐧𝐝𝐛𝐨𝐱 𝐟𝐫𝐨𝐦 𝐎𝐫𝐠𝐚𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧]; 𝐢𝐟(𝐚_𝐎𝐑𝐆.𝐈𝐬𝐒𝐚𝐧𝐝𝐛𝐨𝐱){ 𝐒𝐲𝐬𝐭𝐞𝐦.𝐝𝐞𝐛𝐮𝐠('𝐓𝐡𝐢𝐬 𝐢𝐬 𝐒𝐚𝐧𝐝𝐛𝐨𝐱'); } 𝐞𝐥𝐬𝐞{ 𝐒𝐲𝐬𝐭𝐞𝐦.𝐝𝐞𝐛𝐮𝐠('𝐓𝐡𝐢𝐬 𝐢𝐬 𝐏𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧'); } ⏩ Organization will always return only one record all the time. ⏩ So you can return the query in one object or list of objects. ⏩ You will still get the results.
9 months ago | [YT] | 2
IM Salesforce
⭐𝑯𝒐𝒘 𝒕𝒐 𝒄𝒉𝒆𝒄𝒌 𝒊𝒇 #𝑺𝒂𝒍𝒆𝒔𝒇𝒐𝒓𝒄𝒆 𝑶𝑹𝑮 𝒊𝒔 𝑺𝒂𝒏𝒅𝒃𝒐𝒙 𝒐𝒓 𝑷𝒓𝒐𝒅𝒖𝒄𝒕𝒊𝒐𝒏 ❓
⏩ Using Apex class to check if the current ORG is a sandbox or Production.
⏩ Salesforce has a sObject called Organization.
⏩ This sObject has a standard field, IsSandbox Which will be true if it is a sandbox.
⏩ For Production this field will be false.
⏩ Sample Code:
𝐎𝐫𝐠𝐚𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧 𝐚_𝐎𝐑𝐆 = [𝐒𝐞𝐥𝐞𝐜𝐭 𝐈𝐝, 𝐍𝐚𝐦𝐞, 𝐈𝐬𝐒𝐚𝐧𝐝𝐛𝐨𝐱 𝐟𝐫𝐨𝐦 𝐎𝐫𝐠𝐚𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧];
𝐢𝐟(𝐚_𝐎𝐑𝐆.𝐈𝐬𝐒𝐚𝐧𝐝𝐛𝐨𝐱){
𝐒𝐲𝐬𝐭𝐞𝐦.𝐝𝐞𝐛𝐮𝐠('𝐓𝐡𝐢𝐬 𝐢𝐬 𝐒𝐚𝐧𝐝𝐛𝐨𝐱');
}
𝐞𝐥𝐬𝐞{
𝐒𝐲𝐬𝐭𝐞𝐦.𝐝𝐞𝐛𝐮𝐠('𝐓𝐡𝐢𝐬 𝐢𝐬 𝐏𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧');
}
⏩ Organization will always return only one record all the time.
⏩ So you can return the query in one object or list of objects.
⏩ You will still get the results.
9 months ago | [YT] | 2